Question: Code the car class indicated below: Car //name of class - string model //private member variables - int year - double price - string color

Code the car class indicated below:

Car //name of class

- string model //private member variables

- int year

- double price

- string color

+ Car() //public class functions

+ Car(string newModel, int newYear, string newColor)

+ void setPrice(double newPrice)

+ void setColor(string newColor)

+ void setYear(int newYear)

+ void setModel(int newModel)

+ double getPrice() const

+ string getColor() const

+ int getYear() const

+ string getModel() const

+ bool operator>(const Car& obj) const (Cars are compared by price only)

+ bool operator<(const Car& obj) const

+ void display() const

Code the main function:

Write an program for NiftyGMC Dealer, which keeps track of their lot inventory. Your program is to allow the user to perform any of of the following until he/she wishes to exit: (program is to use either a vector or an Car array)

1 add a Car to the Car inventory (user provides info on Car)

2 - print out all Cars

3 - accept a price from the user. Print out all Cars that are that price

4 - print out the cheapest Car on the lot

5 ask the user to enter a color . Print out all vehcles that are that color

6 ask the user for a year . print out all vehicles that were made that year

7 - EXIT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!