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
Cerrena [4.2K]
3 years ago
6

Design the below using an array// Sunrise Freight charges standard// per-pound shipping prices to the five states they serve// –

- IL IN OH MI WI// -- 0.60 0.55 0.70 0.65 0.67// Modify this program to reduce its size// by using arraysstartDeclarationsstring statenum poundsstring foundItstring BAD_STATE_MSG = "Sorry, we do not ship to "string FINISH = "XXX"getReady()while state <> FINISHfindPrice()endwhilefinishUp()stopgetReady()output "Enter state or ", FINISH, " to quit"input statereturnfindPrice()foundIt = "N"if state = "IL" thenprice = 0.60foundIt = "Y"elseif state = "IN" thenprice = 0.55foundIt = "Y"elseif state = "MI" thenprice = 0.70foundIt = "Y"elseif state = "OH" thenprice = 0.65foundIt = "Y"elseif state = "WI" thenprice = 0.67foundIt = "Y"endifendifendifendifif foundIt = "N" thenoutput BAD_STATE_MSG, stateelseoutput "Enter pounds "input poundsoutput "Cost per pound to ship to ", state, " is ", priceoutput "Total cost is ", price * poundsendifoutput "Enter next state or ", FINISH, " to quit"input statereturnfinishUp()output "End of job"return
Computers and Technology
1 answer:
Nataliya [291]3 years ago
3 0

Answer:

string state

num pounds

num SIZE = 5

string STATES[SIZE] = [“IL”, “IN”, “OH”, “MI”, “WI”]

num PRICES[SIZE] = [0.60, 0.55, 0.70, 0.65, 0.67]

num temp

string foundIt

string BAD_STATE_MSG = "Sorry, we do not ship to ”

string FINISH = “XXX”

getReady()

while state <> FINISH

findPrice()

endwhile

finishUp()

stop

getReady()

output "Enter state or ", FINISH, " to quit"

input state

return

findPrice()

foundIt = "N"

temp = 0

index = 0

while temp < SIZE

if state = STATES[temp] then

foundIt = "Y"

index = temp

temp = SIZE

endif

temp = temp + 1

endwhile

if foundIt = "N" then

output BAD_STATE_MSG, state

else

price = PRICES[index]

output “Enter pounds “

input pounds

output “Cost per pound to ship to ”, state, “ is ”, price

output “Total cost is ”, price * pounds

endif

output "Enter next state or ", FINISH, " to quit"

input state

return

finishUp()

output "End of job"

return

Explanation:

  • Initialize the required variables and arrays.
  • Inside the while loop, call the findPrice() method.
  • Run a while loop until temp is less than Size.
  • If state is found then set the value of foundIt variable to "Y" and assign the value of temp to index variable.
  • Finally call the finishUp method and return.

You might be interested in
How to save a file for the first time?​
White raven [17]

by typing ctrl+ s on keyboard

7 0
2 years ago
Read 2 more answers
Which of the following is a principle that can improve the efficiency of I/O?
natulia [17]

Answer:

C)

Explanation:

One principle that can improve the efficiency of I/O would be to move processing primitives into hardware. Primitives are a semantic value representing something else such as words or numbers within the programming language. By moving them into hardware they system is able to read them at a much faster speed making the I/O more efficient.

5 0
3 years ago
Read 2 more answers
What is the other name designated to a game master of multiplayer online games (MMOs)?
kari74 [83]

Answer: b. expert

Explanation: generally game masters have more experience than most other players and help moderate the game.

6 0
3 years ago
Read 2 more answers
Write two lines of code to draw the following circles centered at 600,600. The radius of the smallest circle is 200. There are 5
Bad White [126]

Answer:

canvas.draw_circle((600, 600), 200, 3, "Black")

canvas.draw_circle((600, 600), 250, 3, "Black")

Explanation:

# include < conio.h>

# include < iostream.h>

int canvas.draw_circle,

namespace std

{

canvas.draw_circle((600, 600), 200, 3, "Black")

canvas.draw_circle((600, 600), 250, 3, "Black")

}

return,

7 0
3 years ago
16 POINTS
Nostrana [21]
It think it's a Nested List.
Im so sorry if this is wrong
6 0
3 years ago
Other questions:
  • _____ is two or more connected computers.
    8·1 answer
  • System memory is on a computer motherboard?
    14·2 answers
  • A(n) Answer display color uses the least electricity when compared to any other color.
    15·1 answer
  • Which of the following is not a valid SQL command? (Points : 2) UPDATE acctmanager SET amedate = SYSDATE WHERE amid = 'J500';
    11·1 answer
  • Which of the following is an easy steps to take to avoid ESSD well working on your computer?
    5·1 answer
  • The new tag in HTML 5 means that it explanation or pronunciation of characters for Asian typography O sets a container for an ex
    12·1 answer
  • which program monitors the computer by looking for known trouble makers as well as suspicious behavior​
    11·1 answer
  • In design and implementation of any _____ reasoning application, there are 4 Rs involved: retrieve, reuse, revise, and retain.
    7·1 answer
  • Which phrase suggests feedback?
    13·1 answer
  • Please help me i’ll give you brainlist
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!