1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stiks02 [169]
3 years ago
9

Write a program called DeliveryCharges for the package delivery service in Exercise 4. The program should again use an array tha

t holds the 10 zip codes of areas to which the company makes deliveries. Create a parallel array containing 10 delivery charges that differ for each zip code. Prompt a user to enter a zip code, and then display either a message indicating the price of delivery to that zip code or a message indicating that the company does not deliver to the requested zip code.
Computers and Technology
1 answer:
lukranit [14]3 years ago
6 0

Answer:

zip_codes = ["11111", "22222", "33333", "44444", "55555", "66666", "77777", "88888", "99999", "00000"]

charges = [3.2, 4, 1.95, 5.7, 4.3, 2.5, 3.8, 5.1, 6.6, 7.3]

deliver = False

index = -1

zip_code = input("Enter the zip code: ")

for i in range(len(zip_codes)):

   if zip_code == zip_codes[i]:

       deliver = True

       index = i

       break

if deliver:

       print("The charge of delivery to " + zip_codes[index] + " is $" + str(charges[index]))

else:

   print("There is no delivery to " + zip_code)

Explanation:

*The code is in Python.

Initialize the zip_codes array with 10 zip codes

Initialize the charges array with 10 corresponding values

Initialize the deliver as False, this will be used to check if the zip code is in the zip_codes

Initialize the index, this will be used if the zip code is a valid one, we will store its index

Ask the user to enter the zip_code

Create a for loop that iterates the length of the zip_codes array. Inside the loop:

Check if the zip_code is equal to the any of the items in the zip_codes. If it is, set the deliver as True, set the index as i, and break

When the loop is done, check the deliver. If it is True, then print the charge of the delivery. Otherwise, print that there is no delivery to that zip code

You might be interested in
Can someone who is good at 9th class IT (cbsce) can help me in my homework​
postnew [5]

Answer: yeah

Explanation:

4 0
3 years ago
I am a bunch of large LANS spread out over several physical locations. Who am I?
Ivan

Answer:

You're WAN

Explanation:

Wide Area Network

8 0
3 years ago
Maria wants to create an image for a Web page. Maria should use _____. help me
Inessa [10]
Graphics software
Hope it helps
8 0
3 years ago
Read 2 more answers
How do I do this wow
astraxan [27]

Answer:

no sweat

Explanation:

variable = [X]

while n <  8:

    print(variable)

    variable.append("X")

    variable.append("X")

    n += 2

this is not very well written im tired i just woke up

6 0
4 years ago
You are working the 8:00 AM shift at the help desk. An irate user who fails to identify himself calls in claiming that his works
WARRIOR [948]

Answer:

Calmly ask him for his name and a more detailed explanation of the problem.

Explanation:

Since in the question,  it is mentioned that the anger use who fails to identify himself and claim that his workstation is malfunctioning and want to fix it now

Now the action which would be taken is to ask his name in a calmy manner and understand what the actually problem he is suffering by understanding it in a detailed way

Therefore according to the given case, the correct option is d.

3 0
3 years ago
Other questions:
  • The computer stores a program while the program is running, as well as the data thatthe program is working with, in _____.
    10·1 answer
  • ___refers to self-acting or self-operating.
    11·1 answer
  • Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishment
    13·1 answer
  • In order to create strong neural networks (connections) in your brain, you've got to __________ the learning process.
    14·1 answer
  • Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) w
    6·1 answer
  • Different search engines available on the internet​
    7·1 answer
  • OBJECTIVE QUESTIONS
    10·1 answer
  • What is the basic process of programming?
    5·1 answer
  • What is the Digital Living Network Alliance ?
    5·2 answers
  • Hi Lesiana, After your presentation last week, the manager thinks an in-house solution is the way to go. Although our programmer
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!