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
An attacker tried to hack into the database of a reputed organization. The attacker inserted malicious code into the query of a
babunello [35]

a.) input attack is the correct answer

4 0
3 years ago
Readability is the level of vocabulary used on the page. True or false
konstantin123 [22]

Answer:

FALSE....john has no idea what hes talking about. i knew this was false yet i looked it up and got it wrong anyway because of john its freaking false

Explanation:

8 0
3 years ago
Cuando fue creada la aplicación Adobe Photoshop (creada, no lanzada)
Cloud [144]

Answer:

en el año 1991

Explanation:

:)

4 0
2 years ago
What is the preferences of occupation in ones life?
umka21 [38]

Answer:

mark me brai list i request u

6 0
2 years ago
(Exhibit: Production Possibilities Curves 2) Assume that a nation is operating on production possibilities curve CD. Economic gr
Alex

Answer:

b. shift from curve CD to curve EF.

Required Details of the Question:

The image of the curve required to answer the question has been attached.

Explanation:

A production possibilities curve shows various combinations of the amounts of two goods( in this case capital and consumer goods) which can be produced within the given resources and a graphical representation showing all the possible options of output for the two products that can be produced using all factors of production.

Now the growth of an economy is best illustrated in the image by the shift from curve CD to curve EF, this means that as the nation's production capacity increases, its production possibilities curve shift outward showing an increase in production of both goods.

3 0
3 years ago
Other questions:
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • Can someone fix this so that it only says "its a payday" on 15 and 30 and on all other days "sorry, it's not payday"
    9·1 answer
  • Which of the following is not an advantage of using asynchronous data transmission
    15·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • The purpose of a software design is to enable programmers to implement the requirements by designating the projected parts of th
    14·1 answer
  • Many of the first photographers were actullay scientists and inventors
    11·1 answer
  • Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,
    7·1 answer
  • When you touch a hot stove, along which pathway will the impulses travel and what is the final destination in the cns?
    12·1 answer
  • Digital censorship uses automated, intelligent systems with big data storage to _____. Select 3 options.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!