Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the selection statement within the pseudo code below in order to complete

ID: 3852210 • Letter: W

Question


Write the selection statement within the pseudo code below in order to complete the pseudo code. A rental car company uses the following procedure to determine the total charges: Car Type: 1 - Compact exist30 per day/exist195 per week 2 - Medium sized exist45 per day/exist285 per week 3 - Luxury exist55 per day/exist350 per week Input (from user): Car Type (1, 2, or 3) Rent code - (1 = Daily or 2 = weekly) Number of days - (set to 0 if rented by the week. Customers cannot rent for more than 1 week.) Output: Customer's Total Bill Note that there is no need to validate the input.

Explanation / Answer

Pseudo code:

1.   Start

2.  
   2.1       Read type of the car and store in carType variable.
   2.2       Read rent code and store in rentCode variable.
   2.3       Initialize numberOfDays to 0.  
   2.4       Initialize totalCharges to 0.  
  
3.   if carType is equal to 1 then  
       if    rentCode is equal to 1 then
           Read number of days and store in numberOfDays.
           Calculate totalCharges as totalCharges = numberOfDays * 30;              
              
       else
           Calculate totalCharges as totalCharges = 195;
              
   else if carType is equal to 2 then      
       if    rentCode is equal to 1 then
           Read number of days and store in numberOfDays.
           Calculate totalCharges as totalCharges = numberOfDays * 45;              
              
       else
           Calculate totalCharges as totalCharges = 285;
          
   else
       if    rentCode is equal to 1 then
           Read number of days and store in numberOfDays.
           Calculate totalCharges as totalCharges = numberOfDays * 55;              
              
       else
               Calculate totalCharges as totalCharges = 350;
          
4.   Display totalCharges

5.   Stop