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
We all interact with various information systems every day: at the grocery store, at work, at school, even in our cars (at least
Serhud [2]

Explanation:

An information system can be defined as an automated system or not, which is used for the purpose of collecting data and transforming it into relevant information for a given purpose.

Currently, information systems are increasingly used in the organizational environment, for example, as management information systems and decision support systems, which are automated computer systems that provide greater support to a manager's work, due to the amount of data that store and process relevant information to assist in the speed of the decision-making process, since information systems are able to capture a volume of data and analyze it, create standards, find flaws and transmit essential information that makes the manager's work more facilitated and improved.

8 0
3 years ago
Which image format is good for compressing large, complex images like photos into smaller file sizes?
spin [16.1K]

The correct image format is JPEG


3 0
3 years ago
What is the difference between a Computer Science and a Compter Engineer major?
xeze [42]

Answer:

Computer Science is the study of the existing things and programming language to acquire knowledge in that field

Computer engineering is applying the knowledge to invent new things

Explanation:

Computer Science is the study of the existing things and programming language to acquire knowledge in that field

Computer engineering is applying the knowledge to invent new things

If we want to accomplish any task , first you should know how to achieve that task and you should have some knowledge to do that task. Computer Science basically deals with acquiring knowledge in the are of computers.

Computer engineering is the engineering things based on the facts we have alreday

5 0
4 years ago
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.
zysi [14]
Procedure SumEvenOdd(stdin: array [0..100] of integer)
var
   i, sum_even, sum_odd: integer;

begin
   for i := 0 to 100 do begin
       if stdin[i] < 0 then
           break;
       if stdin[i] mod 2 = 0 then //even number
          sum_even := sum_even +  stdin[i]
       else 
          sum_odd := sum_odd +  stdin[i]; 

       ShowMessage('sum of even is ' + IntToStr(sum_even) + ' ' + 'sum of odd                                  is' + IntToStr(sum_odd) ) ;
   end; 

end
5 0
4 years ago
In terms of technolagy, soft wear is defined as
tia_tia [17]

Answer:

the programs and other operating information used by a computer.

Explanation:

4 0
3 years ago
Other questions:
  • A(n) _____ is a fake online persona created to promote a particular point of view, often in praise of a firm, product, or indivi
    15·1 answer
  • Read the description of Mike’s work, and identify his profession. Mike’s job is to record sounds in a studio. He studies a video
    14·2 answers
  • which quotation from the story of the fisherman in the Arabian nights' entertainments supports the theme that cleverness trumps
    15·1 answer
  • Which level of education do most peoplebecoming a broadcast analyst obtain?
    13·2 answers
  • Median of a sample If the distribution is given, as above, the median can be determined easily. In this problem we will learn ho
    15·1 answer
  • Write a C++ program that will ask the user for the name of a data file.
    11·1 answer
  • Keely has an automation tool in place that runs a number of different processes for her and has for the last two years. All of a
    8·1 answer
  • What is a user interface have? Plz answer ASAP!!!!!
    15·2 answers
  • Write a script called fact.sh that is located in your workspace directory to calculate the factorial of a number n; where n is a
    14·1 answer
  • What do you do when ur grounded from all electronics and can't go outside and have t clean all day
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!