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
An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When
maksim [4K]

Answer:

The data is transformed to usually make it smaller. It can always be re-constructed back to the original.

Explanation:

I'm on the same lesson on code.org as you, so just go to the question before and the answer to that question was the answer!  ;)

Let me know if you got it right!

5 0
4 years ago
Question #1
Evgen [1.6K]

Answer:

Pseudocode and flowchart.

Explanation:

I just got it correct.

8 0
3 years ago
1. In the canonical form ,the no of variables is?
andrey2020 [161]

The canonical form of a positive integer in decimal representation is a A finite sequence of digits that does not start with zero. More generally, for a class of things on which an equivalence relation is defined, a ecclesiastical form consists in the choice of a specific object in each class.

<h3>What is inequality constraints?</h3>

Number of inequality constraints: While there is a restriction on the number of separate equality constraints, there is no restriction on the digit of inequality constraints.

<h3>What is equality and inequality constraints?</h3>

Terminology. If an inequality constraint holds with equivalency at the optimal point, the constraint is said to be binding, as the issue cannot be varied in the direction of the constraint even though doing so would enhance the value of the objective function.

To learn more about  canonical form, refer

brainly.com/question/14398127

#SPJ9

8 0
1 year ago
Which technology enables afloat forces to communicate more securely and to operate in a more dispersed manner?
Afina-wow [57]
<span>UHF and HF technology enables afloat forces to communicate more securely and to operate in a more dispersed manner.
</span>UHF stands for Ultra High Frequency, while HF stands for <span>High Frequency .
</span>The UHF range of the radio spectrum is the band<span> extending from 300</span>MHz<span> to 3 GHz and </span>is extensively used for satellite<span>communication and broadcasting, in </span>cellular telephone<span> and paging systems, and by third-generation (</span>3G<span>) </span>wireless services.
5 0
3 years ago
1.6.1: Identifier validator. Check if the following identifiers are valid: c, cat, n1m1, short1, _hello, 42c, hi there, and cat!
pogonyaev

Answer:

correct option c, cat, n1m1, short1,

Explanation:

correct option c, cat, n1m1, short1,

The variable is used to store the value of the value varies during the program execution...

some of the basic rules of identifier

  • The variable must be started with the alphabet  
  • We cannot declare the variable name as keyword i.e "that value is already defined and in the compiler"
  • Variable-length does not exceed 8 characters  
  • We cannot use space to declared any variable
  • _hello,42C, hi there and cat! are not follow the basic rule of identifier so they are not identifier validator
5 0
4 years ago
Other questions:
  • A network on the internet has a subnet mask of 255.255.240.0. what is the maximum number of hosts it can handle
    5·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • In 2-3 sentences, explain to another student why shortcuts are beneficial. Include details about shortcuts that you have used.
    10·2 answers
  • What data unit is addressed based on the IP address of the recipient?
    8·1 answer
  • A router has just received the following new IP addresses: 88.62.108.0/21, 88.62.116.0/21, 88.62.120.0/21 and 88.62.128.0/21. If
    5·1 answer
  • Give two reasons you should be aware of your computer's system components and their characteristics.
    10·1 answer
  • What is binary number system? Why is it used in computer system?
    13·2 answers
  • Somebody pls help!!! i don’t know what i did but i don’t know how to fix it
    8·1 answer
  • JAVA
    10·1 answer
  • What is the difference between
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!