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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
100%

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

Expert Solution
Step 1

We need to modify the pseudocode for correct output. 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning