Bobst_ArynFix3_M04

docx

School

Ivy Tech Community College, Indianapolis *

*We aren’t endorsed by this school

Course

120

Subject

Economics

Date

Jan 9, 2024

Type

docx

Pages

3

Uploaded by MasterBaboon3951

Report
// This pseudocode determines and outputs 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 rate num STD_RATE = 65 num COMPACT_RATE = 40 num SUB_RATE = 30 num DAYS_FOR_DISCOUNT = 7 num DISCOUNT_RATE = 0.20 string QUIT = "ZZZZ" 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 carType = "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 - (rate * DISCOUNT_RATE) endif output "Rental Fee for a", carType, " car for ", days, " days: $", rate * days endif output "Enter car type or ", QUIT, " to quit " input carType return
finish() output "End of program" return
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help