STRICTLY USE TEMPLATE PROVIDED AT END OF QUESTION. ---------------------------------- On account of Diwali, a pre-owned Car Dealer “Silicon Motors”, has announced attractive discount sales. The Outlet Head has fixed the discount rates of the Cars based on the years of usage and condition of a car. Akash, a teenager wished to buy an economical pre-owned Car of any famous brand but that was in pretty good condition. Having known about the discount offers at “Silicon Motors”, he visited the showroom to see if he could get convincing Models. After glimpsing through the Cars in the display, Akash wanted to calculate the discount price for those Cars that he was interested in so that he could conclude his selection. Write a C++ program to calculate the discount price of the Cars of his choice. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Consider a class called Car which has the following private variables. Datatype Variable string model double price string condition int year Include the following overloading function in the class Car. Function Name Description void price(string model, double price) This function displays the model and actual price of the car. void price(string model, double price, string condition, int year) This function is used to calculate the price after the discount of the car based on the years of usage and condition of the car.   If the years of usage is less than 3 years and the car condition is good the discount will be 20%. If the years of usage is greater than 5 years and the car condition is good, then the discount will be 40%. If the years of usage is greater than 5 years and the car condition is moderate, then the discount will be 50%. If the years of usage is greater than 5 years and the car condition is poor, then the discount will be 60%. Input and Output Format: All double values should be displayed with two decimal places. Refer sample input and output for formatting specifications. [All text in bold corresponds to input and the rest corresponds to the output] Sample Input and Output 1: Enter the model of the car verna Enter the actual price of the car 150000 Enter the years of usage of the car 2 Enter the condition of the car good Car Details Model : Verna Actual Price : 150000 Price after discount : 120000   -----------End Of Question----------- TEMPLATE BELOW car.cpp using namespace std; class Car { private: string model; double price; string condition; int year; public: void price(string model,double price){ //Fill your code here } void price(string model,double price,string condition,int year){ //Fill your code here } };

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
100%

STRICTLY USE TEMPLATE PROVIDED AT END OF QUESTION.

----------------------------------

On account of Diwali, a pre-owned Car Dealer “Silicon Motors”, has announced attractive discount sales. The Outlet Head has fixed the discount rates of the Cars based on the years of usage and condition of a car.

Akash, a teenager wished to buy an economical pre-owned Car of any famous brand but that was in pretty good condition. Having known about the discount offers at “Silicon Motors”, he visited the showroom to see if he could get convincing Models. After glimpsing through the Cars in the display, Akash wanted to calculate the discount price for those Cars that he was interested in so that he could conclude his selection.

Write a C++ program to calculate the discount price of the Cars of his choice.

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

Consider a class called Car which has the following private variables.

Datatype Variable
string model
double price
string condition
int year


Include the following overloading function in the class Car.

Function Name Description
void price(string model, double price) This function displays the model and actual price of the car.
void price(string model, double price, string condition, int year) This function is used to calculate the price after the discount
of the car based on the years of usage and condition of the car.

 

If the years of usage is less than 3 years and the car condition is good the discount will be 20%.
If the years of usage is greater than 5 years and the car condition is good, then the discount will be 40%.
If the years of usage is greater than 5 years and the car condition is moderate, then the discount will be 50%.
If the years of usage is greater than 5 years and the car condition is poor, then the discount will be 60%.


Input and Output Format:
All double values should be displayed with two decimal places.
Refer sample input and output for formatting specifications.


[All text in bold corresponds to input and the rest corresponds to the output]
Sample Input and Output 1:

Enter the model of the car
verna
Enter the actual price of the car
150000
Enter the years of usage of the car
2
Enter the condition of the car
good
Car Details
Model : Verna
Actual Price : 150000
Price after discount : 120000

 

-----------End Of Question-----------

TEMPLATE BELOW

car.cpp

using namespace std;

class Car
{
private:
string model;
double price;
string condition;
int year;

public:
void price(string model,double price){
//Fill your code here
}

void price(string model,double price,string condition,int year){
//Fill your code here
}
};

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
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