Posted by steve on Thursday, December 1, 2011 at 12:03pm.
I don't see a pseudocode, but will be glad to comment/critique if you supply one.
// This pseudocode should determine 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
num STD_RATE = 65
num COM_RATE = 40
num SUB_RATE = 30
num DAYS_FOR_DISCOUNT = 7
num DISCOUNT_RATE = 0.20
string QUIT = "ZZZZ"
string carType
num days
num rate
num discount
num totalFee
getReady()
while carType != QUIT
detailLoop()
endwhile
finish()
stop
getReady()
output "Enter car type or ", QUIT, " to quit "
input carType
return
detailLoop()
rate = 0
days = 0
discount = 0
minFee = 200
output "Enter days rented "
input days
if carType = "Standard" then
rate = STD_RATE
if carType = "Compact" then
rate = COM_RATE
if carType = "Subcompact" then
rate = SUB_RATE
if rate = 0 then
errorInvalidCarType()
if days >= DAYS_FOR_DISCOUNT then
discount = (rate * days) * DISCOUNT_RATE
totalFee = (rate * days) – discount
output “Rental fees for car is: $”, totalFee
getReady()
return
errorInvalidCarType()
output "Invalid car type, use Standard, Compact, or Subcompact"
getReady()
return
finish()
output "End of program"
return
Can someone tell me if i did this right?
Related Questions
math problem/break even point - Hondas rent for $25 per day and $.24 (24 cents) ...
arithmetic - kim can a rent a boat from company A for $ 120 for the whole day ....
Calculus - A car rental agency rents 180 cars per day at a rate of 32 dollars ...
Probability - rent-4-wheels makes a profit of $12 per day for each car rented, ...
Math-Algebra 2 - Ace Rent a Car charges a flat fee of $15 and $0.25 a mile for ...
Business - Sundown Rent-a-Car, a large automobile rental agency operating in the...
algebra 2 - A rental car agency charges $13 per day plus 12 cents per mile to ...
algebra - A car rental company has two rental rates. Rate 1 is $63 per day plus...
Algebra - Hertzy Car Rental: Charge a fixed rate of $58 with NO mileage charge. ...
math - Car rental agency A charges $50 per day plus 10 cents per mile driven. ...
For Further Reading