0% found this document useful (0 votes)
39 views4 pages

Program Implementation SBA 2024

This program calculates the total rental fee for three car brands - Sentra, Maxima, and Altima. It uses variables to track the number of each model rented and calculates the rental fee for each by multiplying the count by the fee for that model. It then outputs the totals for each model rented as well as the grand total.

Uploaded by

Indar Soochit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

Program Implementation SBA 2024

This program calculates the total rental fee for three car brands - Sentra, Maxima, and Altima. It uses variables to track the number of each model rented and calculates the rental fee for each by multiplying the count by the fee for that model. It then outputs the totals for each model rented as well as the grand total.

Uploaded by

Indar Soochit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Pascal

Program CarRental;

{Name: CarRental
Date: 20/2/2023
Description: This program calculates the total rental; fee for three car brands}

Var {variable declaration}


CarModel:String;
NumberOfCarsRented:Integer;
SentraCount:Integer;
MaximaCount:Integer;
AltimaCount:Integer;
SentraRental:Real;
MaximaRental:Real;
AltimaRental:Real;
Rental:Real;
Total:Real;
GrandTotal:Real;

Const {constants declaration}


SentraRentalFee= 15;{Sentra rental fee $1,500}
MaximaRentalFee= 20;{Maxima rental fee $2,000}
AltimaRentalFee= 25;{Altima rental fee $2,500}

Begin {Start of the program}


{Initialization of Variables}
CarModel:= 'Sentra,Maxima,Altima';
NumberOfCarsRented:= 0;
SentraCount:= 0;
MaximaCount:= 0;
AltimaCount:= 0;
Write('Enter Model of Car ( Sentra, Maxim or Altima), Type End to stop:');
Readln(CarModel);
While CarModel <> 'End' Do
Begin {Start of While Loop}
Write('Enter Number of Vehicles Rented:');
Readln(NumberOfCarsRented);
If CarModel = 'Sentra' then
SentraCount:= SentraCount+ NumberOfCarsRented;
If CarModel = 'Maxima' then
MaximaCount:= MaximaCount+ NumberOfCarsRented;
If CarModel = 'Altima' then
AltimaCount:= AltimaCount+ NumberOfCarsRented;
Write('Enter Model of Car (Sentra, Maxim or Altima),Typer End to
stop:');
Readln(CarModel);

End; {End of the While Loop}


SentraRental:= SentraCount*SentraRentalFee;
Writeln('Number of Sentra vehicles rented:',SentraCount);
Writeln('Total Rental Fee of Sentra: ', SentraRental:0:2);
MaximaRental:= MaximaCount*MaximaRentalFee;
Writeln('Number of Maxima vehicles rented:',MaximaCount);
Writeln('Total Rental Fee of Maxima: ', MaximaRental:0:2);
AltimaRental:= AltimaCount*AltimaRentalFee;
Writeln('Number of Altima vehicles rented:',AltimaCount);
Writeln('Total Rental Fee of Altima: ', AltimaRental:0:2);

GrandTotal:= SentraRental+MaximaRental+AltimaRental;
Writeln('GrandTotal Fee:= GrandTotal: ', GrandTotal:0:2);
End. {End of program}

You might also like