programming

posted by .

This pseudocode should detrmine 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

  • programming - java -

    I don't see a pseudocode, but will be glad to comment/critique if you supply one.

  • programming -

    // 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

  • programming -

    Can someone tell me if i did this right?

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. math problem/break even point

    Hondas rent for $25 per day and $.24 (24 cents) per mile. Toyotas rent for $31 per day and $.19 (19 cents) per mile. Write a cost equation for each rental car The distance from Monterey, Ca to San Francisco, Ca is about 110 miles. …
  2. College Algebra

    A couple wants to rent a car for one day while on vacation. Frank's Automotive Rental wants $29 a day and $0.17 per mile, while Coups-For--Day wants $21 a day and $0.19 per mile . After how many miles wo9uld the price from Coups exceed …
  3. Algebra

    A couple wishes to rent a car for one day while on vacation. Ford Auto Rental wants $35.00 per day and 14¢ per mile, while Chevrolet-For-A-Day wants $34.00 per day and 16¢ per mile. After how many miles would the price to rent the …
  4. Problem solving

    A rental car agency charges $15 per day plus $.11 per mile to rent a certain car. Another agency charges $18 per day plus 8 cents per mile to rent the same car. If they rent the car for one day how many miles will they have to be driven …
  5. Problem solving

    A rental car agency charges $15 per day plus $.11 per mile to rent a certain car. Another agency charges $18 per day plus 8 cents per mile to rent the same car. If they rent the car for one day how many miles will they have to be driven …
  6. Math

    A rental car agency charges $15 per day plus $.11 per mile to rent a certain car. Another agency charges $18 per day plus 8 cents per mile to rent the same car. If they rent the car for one day how many miles will they have to be driven …
  7. Algebra

    You pay $1 to rent a movie plus an additional $0.50 per day until you return to the movie. Your friend pays $1.25 per day to rent a movie. a: make tables showing the costs to rent a movie up to 5 days. $1.50 $2.00 $2.50 $3.00 $3.50 …
  8. Math

    Hello, I need to use a matrix to solve this but am stumped on how to do it. All I need is a little nudge to push me in the right direction. Please help. Thank you You have been hired as a consultant for Crazy Al’s Car Rentals, a …
  9. Math

    Hello, I need to use matrices in order to solve this problem but I am having a hard time getting started with the problem. I just need a little push to nudge me in the right direction. Please help. Thank You. You have been hired as …
  10. Math

    The cost of renting a car from Rent-it Cheap for one day is $29 plus 50 cents per km. For the same period, Thrift Cars charges $37 plus 48 cents per km. When would it be more economical to rent a car from Thrift Cars?

More Similar Questions