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
What is the most efficient<br> form of transportation we<br> have?
alisha [4.7K]

Answer:

The bicycle is a tremendously efficient means of transportation. In fact cycling is more efficient than any other method of travel--including walking! The one billion bicycles in the world are a testament to its effectiveness

Explanation:

6 0
2 years ago
Read 2 more answers
An organization’s IRP prioritizes containment over eradication. An incident has been discovered where an attacker outside of the
emmasim [6.3K]

Answer:

The correct answer is (a) Remove the affected servers from the network.

Explanation:

Solution:

Now, since the organisation top priority is more of  containment over eradication, an outbreak code that is hostile as an can be suppressed effectively by removing the web server completely from the over all network facilities or infrastructure.

Also, if the affected servers are not removed, it might affect the integrity, confidentiality of sensitive materials or documents which will be exposed to the outside world by the attacker.

4 0
3 years ago
Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consis
DerKrebs [107]

Answer:

Follwing is the python code:-

word=str(input("Enter the string\n"))

new=word[0:3] #expression for first three characters of the string.

print(new)

Output:-

Enter the string

chandelier

cha

Explanation:

The expression word[0:3] is for extracting first three characters form the string.

word[0:3] = It extracts characters from index 0 to index 2 it does not include 3.3 is excluded.

7 0
3 years ago
You want to substitute one word with another throughout your
Hitman42 [59]
I’m pretty sure it’s “Find and paste”
8 0
3 years ago
What programs are most likely affected by a macro virus?
Iteru [2.4K]

Answer:

Macro viruses usually infect Microsoft Office apps like Word and Excel.

Explanation:

7 0
2 years ago
Other questions:
  • What two images did you have to add to the wds server to handle the windows installation?
    7·1 answer
  • A(n) ____ backup only archives the files that have been modified since the last backup.
    11·1 answer
  • Describe two ways in which an organizer can assist in taking notes
    8·2 answers
  • Which of the following journals is not aimed at the public as well as scientists?
    7·1 answer
  • On five lane roadways, the center lane is designated for __________ and is used by vehicles traveling in both directions.A. Thro
    15·1 answer
  • what are the benefits of VolP? select all that apply. A:cheaper printings B:clearer calls C: faster download D: increased effici
    11·2 answers
  • , 13 dB correspond to a power ratio of ....?
    14·1 answer
  • Consider a system consisting of processes P1 , P2 , ..., Pn , each of which has a unique priority number. Write a monitor that a
    14·1 answer
  • What is an advantage and disadvantage to file compression
    8·1 answer
  • What is the value of 8n when n= = 2?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!