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
Word Bank:
NNADVOKAT [17]

Explanation:

circle with radius and colour red

3 0
2 years ago
You can use the___<br> to copy data from Excel to Access.
kap26 [50]

Answer:

You can use the Import spreadsheet wizard program.

Explanation:

On the Office ribbon, select the External Data tab and click Excel. The "Get External Data - Excel Spreadsheet" wizard appears. In the File name field, browse to the Excel file. Select the "Import the source data into a new table in the current database" option and click OK.

8 0
2 years ago
Can someone help me?
stich3 [128]

Answer:

2nd one

Explanation:

7 0
3 years ago
Read 2 more answers
What would happen if computers only had input peripherals and a CPU?
lisov135 [29]
Then there would be no way to see the output based off what you input. =)
3 0
2 years ago
A curb of this color means you may stop only to pick up or drop offs passengers or male
Delicious77 [7]
I believe it is a white curb!
7 0
3 years ago
Other questions:
  • Describe the difference between Global knowledge and personal idea. Why is it important to give credit to others by citing their
    6·1 answer
  • Ryan is looking at investment opportunities as a cloud service provider. He wants to invest in a deployment-based cloud model th
    11·2 answers
  • Which features would work well for text entered into cells? Check all that apply.
    5·2 answers
  • Write code that prints: usernum ... 2 1 blastoff! your code should contain a for loop. print a newline after each number and aft
    12·1 answer
  • The famous study entitled ""Protection Analysis: Final Report"" focused on a project undertaken by ARPA to understand and detect
    14·1 answer
  • What is one way to recognize whether an online source has been copyrighted? The source features the phrase “all rights reserved.
    6·2 answers
  • Which value can be entered to cause the following code segment to display the message "That number is acceptable."? ____.
    15·1 answer
  • What is the reasoning you would write an inquiry to a company?
    5·2 answers
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • What is the output of the following code?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!