Computers and Technology

DEBUG // This pseudocode should determine and output the rental fees for cars.
// Standard cars rent for $65 per day, compacts rent for $40 per day,
// and subcompacts rent for $30 per day. Rentals for at least 7 days
// receive a 20% discount. An error message is displayed if the car type
// is not valid.

start
Declarations
string carType
num days
num STD_RATE = 65
num COM_RATE = 40
num SUB_RATE = 30
num DAYS_FOR_DISCOUNT = 10
num DISCOUNT_RATE = 0.20
string QUIT = ""
getReady()
while carType <> QUIT
detailLoop()
endwhile
finish()
stop

getReady()
output Enter car type or , QUIT, to quit
input carType
return

detailLoop()
output "Enter days rented "
input days
if carType = "Standard" then
rate = STD_RATE
else
if car_Type = "Compact" then
rate = COMPACT_RATE
else
if carType = "Subcompact" then
rate = SUB_RATE
else
rate = 0
output "Invalid car type"
endif
endif
endif
if rate <> 0
if days >= DAYS_FOR_DISCOUNT then
rate = rate * DISCOUNT_RATE
endif
output carType, days
output "Enter car type or ", QUIT, " to quit "
input carType
return

finish()
output "End of program"
return

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:30, camerondillonn
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
image
Computers and Technology, 22.06.2019 14:30, binodkharal2048
Hi plz 11 ! when planning a table, what step comes first: "define the column headers" or "calculate the number of columns/rows"? a. calculate the number of columns/rows b. define the column headers
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, CalCDanG
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
image
Computers and Technology, 23.06.2019 19:40, Latoyajenjins1789
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system. currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system. currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system. currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
Do you know the correct answer?
DEBUG // This pseudocode should determine and output the rental fees for cars.
// Standard c...

Questions in other subjects:

Konu
Mathematics, 28.08.2019 20:00