C++ program VehicleonRoad Company provides car rental services. The company provides option to rent from three different types of vehicles – S, M or L for small, medium and large . These vehicle types are classified according to size based on the number of passengers it can carry.  The rental prices are charged per day according to the initial cost. A once off refundable cost as deposit needs to paid when the car is picked up for collection. The rental prices and deposit required are listed in the table below.   Type of Car Initial Cost Deposit    S  R500.00 R1130.00 M R620.50 R1136.25 L R740.87 R1240.50   You are tasked to create a C++ program that includes the following functions: amountDue() typeTotal() determineMost() and main()                                 Each of the functions described must have the appropriate parameters. Take note of missing information indicated with ?? that you need to identify to complete function definitions.  Your program must consist of the following functions:             ?? AmtDue(?? carType, ?? daysHired, ?? InitialCost, ?? additionalCost, ?? finalAmountDue)  The function must use the table provided to compute the final amount due based on the initial cost and the deposit cost for the specified car type per customer. A switch statement must be used. This function accepts as parameters carType and daysHired by value and accepts as parameters by reference InitialCost, additionalCost and finalAmountDue.  The rental prices are charged per day based on the initial cost. A once off refundable deposit cost needs to be paid when the car is picked up for collection. A 15% VAT needs to added to determine the final amount due by the customer for car rental. The   InitialCost, additionalCost and finalAmountDue need to be returned to the calling function. 2. ?? typeTotal(?? daysHired, ?? carType, ?? daysHiredTypeS, ?? daysHired TypeM, ?? daysHiredTypeL)  The function must determine the total rented in days per car type.  This function accepts as parameters daysHired and carType by value and accepts as parameters by reference daysHiredTypeS, daysHiredTypeM and daysHiredTypeL. The   daysHiredTypeS, daysHiredTypeM and daysHiredTypeL needs to be returned to the calling function. 3.                 ?? detemineMost(?? daysHired, ?? clientName, ?? highestName, ?? highestDays) The procedure must determine the name of the client who rented the car for the longest duration. This procedure accepts as parameters daysHired and clientName by value and accepts as parameters by reference highestName and highestDays.  The   highestName and highestDays needs to be returned to the calling function. int main() Consider the definition of the function main partially provided (see figure 2.1). Take note of missing code indicated with ??? as well as comments to guide you through coding and completing the main function. The necessary preprocessor directives to compile and run your program is also provided. You are required to tests each of the functions defined above in main and complete the following:   Declare all function prototypes. Use the client name as your sentinel, with a value of END to indicate the end of the clients. Use a Pre-test loop. Prompt the use to enter car type and number of days required to rent the specified car type. Calculate the final amount due for the car type specified for each client. Calculate and display accumulated totals for all clients. Determine and display total rented in days for each type car. Determine and display client who hired car for the most number of days Ensure you all format floating-point values on output operations to 2 decimal places.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ program

VehicleonRoad Company provides car rental services. The company provides option to rent from three different types of vehicles – S, M or L for small, medium and large . These vehicle types are classified according to size based on the number of passengers it can carry.  The rental prices are charged per day according to the initial cost. A once off refundable cost as deposit needs to paid when the car is picked up for collection. The rental prices and deposit required are listed in the table below.

 

Type of Car

Initial Cost

Deposit   

R500.00

R1130.00

M

R620.50

R1136.25

L

R740.87

R1240.50

 

You are tasked to create a C++ program that includes the following functions:

  1. amountDue()
  2. typeTotal()
  3. determineMost() and
  4. main()

                               

Each of the functions described must have the appropriate parameters. Take note of missing information indicated with ?? that you need to identify to complete function definitions.  Your program must consist of the following functions:

 

 

 

 

 

 

  1. ?? AmtDue(?? carType, ?? daysHired, ?? InitialCost, ?? additionalCost, ??

finalAmountDue)

 The function must use the table provided to compute the final amount due based on the initial cost and the deposit cost for the specified car type per customer. A switch statement must be used.

This function accepts as parameters carType and daysHired by value and accepts as parameters by reference InitialCost, additionalCost and finalAmountDue. 

The rental prices are charged per day based on the initial cost. A once off refundable deposit cost needs to be paid when the car is picked up for collection. A 15% VAT needs to added to determine the final amount due by the customer for car rental. The   InitialCost, additionalCost and finalAmountDue need to be returned to the calling function.

2.

?? typeTotal(?? daysHired, ?? carType, ?? daysHiredTypeS, ?? daysHired TypeM, ?? daysHiredTypeL)

 The function must determine the total rented in days per car type.

 This function accepts as parameters daysHired and carType by value and accepts as parameters by reference daysHiredTypeS, daysHiredTypeM and daysHiredTypeL. The   daysHiredTypeS, daysHiredTypeM and daysHiredTypeL needs to be returned to the calling function.

3.

                ?? detemineMost(?? daysHired, ?? clientName, ?? highestName, ?? highestDays)

The procedure must determine the name of the client who rented the car for the longest duration.

This procedure accepts as parameters daysHired and clientName by value and accepts as parameters by reference highestName and highestDays. 

The   highestName and highestDays needs to be returned to the calling function.

  1. int main() Consider the definition of the function main partially provided (see figure 2.1). Take note of missing code indicated with ??? as well as comments to guide you through coding and completing the main function. The necessary preprocessor directives to compile and run your program is also provided.

You are required to tests each of the functions defined above in main and complete the following:

 

  • Declare all function prototypes.
  • Use the client name as your sentinel, with a value of END to indicate the end of the clients. Use a Pre-test loop.
  • Prompt the use to enter car type and number of days required to rent the specified car type.
  • Calculate the final amount due for the car type specified for each client.
  • Calculate and display accumulated totals for all clients.
  • Determine and display total rented in days for each type car.
  • Determine and display client who hired car for the most number of days
  • Ensure you all format floating-point values on output operations to 2 decimal places.
  •  

See figures 2.2 for sample output.       

            

                            

 

 

File
Tools
View
DISTRIBUTE LOCKDOWN 10(2) (Protected View) - Word
PROTECTED VIEW Be careful-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View.
Enable Editing
//EXAM D CODE TOTAL[31]
// include preprocessive directives PROVIDED
#include <iostream>
#include <iomanip>
using namespace
std;
// DEFINE PROTOTYPES
// DEFINE PROTOTYPES AmtDue // (1)
// DEFINE PROTOTYPES detemineMost /I (1)
// DEFINE PROTOTYPES typeTotal // (1)
int main()
// VARIABLES PROVIDED
char cType; // small, mid-size, large car types
int dHired;
string customerName;
double InitCost;
double
addCost;
double fAmountDue;
double totAmountDue = 0.0;
int dHiredTypes = 0;
int dHiredTypeM = 0;
dHiredTypel = 0;
string highName = " ";
int highDays = 0;
// Use the client name as your sentinel, with a value of END to indicate the end of the
clients. Use a Pre-test loop.
// Prompt user for inputs
//Calculate the final amount due for the car type specified for each client.
// Calculate and display accumulated totals for all clients.
// Determine and display total rented in days for each type car.
// Determine
// Ensure you all format floating-point values on output operations to 2 decimal places.
and display client who hired car for the most number of days
return 0;
}
// Code AmtDue function. The procedure must use table provided to compute initial cost
and additional cost and final amount due. Include vat in the final calculation
// Code typeTotal function.
// Code determineMost function.
Figure 2.1
100%
Transcribed Image Text:File Tools View DISTRIBUTE LOCKDOWN 10(2) (Protected View) - Word PROTECTED VIEW Be careful-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View. Enable Editing //EXAM D CODE TOTAL[31] // include preprocessive directives PROVIDED #include <iostream> #include <iomanip> using namespace std; // DEFINE PROTOTYPES // DEFINE PROTOTYPES AmtDue // (1) // DEFINE PROTOTYPES detemineMost /I (1) // DEFINE PROTOTYPES typeTotal // (1) int main() // VARIABLES PROVIDED char cType; // small, mid-size, large car types int dHired; string customerName; double InitCost; double addCost; double fAmountDue; double totAmountDue = 0.0; int dHiredTypes = 0; int dHiredTypeM = 0; dHiredTypel = 0; string highName = " "; int highDays = 0; // Use the client name as your sentinel, with a value of END to indicate the end of the clients. Use a Pre-test loop. // Prompt user for inputs //Calculate the final amount due for the car type specified for each client. // Calculate and display accumulated totals for all clients. // Determine and display total rented in days for each type car. // Determine // Ensure you all format floating-point values on output operations to 2 decimal places. and display client who hired car for the most number of days return 0; } // Code AmtDue function. The procedure must use table provided to compute initial cost and additional cost and final amount due. Include vat in the final calculation // Code typeTotal function. // Code determineMost function. Figure 2.1 100%
Enter customer
File
Tools
View
DISTRIBUTE LOCKDOWN 10(2) (Protected View) - Word
PROTECTED VIEW Be careful-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View.
Enable Editing
DSO17BT
Lock Down Project 10
Microsoft Visual Studio Debug Console
Enter customer name or END to terminate: ClientA
Enter the car Type: S
Enter the number of days of rental: 2
The
amount including vat is: 2449,5e
Enter
r customer name or END to terminate: ClientB
Enter the
Enter the number of days of rental: 4
Туре: S
The amount including vat is: 3599.5e
Enter
Enter the car Type: M
Enter the number of days of rental: 5
The
or END to terminate: ClientC
name
amount including vat is: 4874.56
Enter customer name or END to terminate: ClientD
Enter the car Type: M
Enter the number of days of rental: 1
The amount including vat is: 2020.26
Enter customer name or END to terminate: ClientE
Enter the car Type: L
Enter the number of days of rental: 6
The amount including vat is: 6538.58
Enter customer name or END to terminate: ClientF
Enter the car Type: L
Enter the number of days of rental: 2
The amount including vat is: 3130.58
Enter customer name or END to terminate: END
Total days rented for cars of Type Small 6 days
Total days rented for cars of Type Medium 6 days
Total days rented for cars of Type Large 8 days
The total amount collected is: 22612.98
The client who rented a car for the MOST days is: ClientE for 6 days
Figure 2.2
100%
Transcribed Image Text:Enter customer File Tools View DISTRIBUTE LOCKDOWN 10(2) (Protected View) - Word PROTECTED VIEW Be careful-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View. Enable Editing DSO17BT Lock Down Project 10 Microsoft Visual Studio Debug Console Enter customer name or END to terminate: ClientA Enter the car Type: S Enter the number of days of rental: 2 The amount including vat is: 2449,5e Enter r customer name or END to terminate: ClientB Enter the Enter the number of days of rental: 4 Туре: S The amount including vat is: 3599.5e Enter Enter the car Type: M Enter the number of days of rental: 5 The or END to terminate: ClientC name amount including vat is: 4874.56 Enter customer name or END to terminate: ClientD Enter the car Type: M Enter the number of days of rental: 1 The amount including vat is: 2020.26 Enter customer name or END to terminate: ClientE Enter the car Type: L Enter the number of days of rental: 6 The amount including vat is: 6538.58 Enter customer name or END to terminate: ClientF Enter the car Type: L Enter the number of days of rental: 2 The amount including vat is: 3130.58 Enter customer name or END to terminate: END Total days rented for cars of Type Small 6 days Total days rented for cars of Type Medium 6 days Total days rented for cars of Type Large 8 days The total amount collected is: 22612.98 The client who rented a car for the MOST days is: ClientE for 6 days Figure 2.2 100%
Expert Solution
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education