Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do not remove the questions or text from the Template. Mark any additions to the pseudocode by adding lines and showing them in red. Strikeout

Do not remove the questions or text from the Template. Mark any additions to the pseudocode by adding lines and showing them in red. Strikeout any deletions using the strikeout tool. Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the comments (lines that begin with two slashes) at the beginning of the code. Your job is to alter the pseudocode to meet the new specifications as noted above. Please follow directions as specified in the homework assignment instructions file. NOTE: If a function has no changes to be made to it, then it will be in blue font.
// SunUp Freight charges standard per-pound shipping prices to the five
// states they serve: IL,IN,OH,MI,WI at 0.60,0.55,0.70,0.65, and 0.67
// respectively. Modify this program to reduce its size by using separate // arrays called STATES and PRICES respectively with these values. The
// arrays should be easily changed should the company decide to add a new
// state (i.e., use SIZE constant). Correct any other mistakes as well.
// well. Only change what is necessary. Some new variables will be
// needed.
start
// Declarations
string state
num pounds
num sub
string foundIt
string BAD_STATE_MSG = "Sorry, we do not ship to "
string FINISH ="XXX"
getReady()
while state != FINISH
findPrice()
end
finishUp()
stop
getReady()
output "Enter state or ", FINISH, " to quit"
output state
return
findPrice()
foundIt ="N"
sub =1
while sub <= SIZE
if state = STATES[SIZE] then
foundIt ="Y"
endif
end
if foundIt ="N" then
output BAD_STATE_MSG, state
else
price = PRICES[SIZE]
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"
output state
return
finishUp()
output "End of job"
return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions