Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MODIFY PSEUDOCODE BELOW / / SunUp Freight charges standard per - pound shipping prices to the five / / states they serve: IL , IN
MODIFY PSEUDOCODE BELOW
SunUp Freight charges standard perpound shipping prices to the five
states they serve: ILINOHMIWI at and
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 ie 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 const SIZE
num pounds
num sub
string foundIt
string BADSTATEMSG "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
while sub SIZE
if state STATESSIZE then
foundIt Y
endif
end
if foundIt N then
output BADSTATEMSG state
else
price PRICESSIZE
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started