Question: C++ Code the car class indicated below: Car //name of class - string model //private member variables - int year - double price + Car()
C++
Code the car class indicated below:
| Car //name of class |
| - string model //private member variables - int year - double price |
| + Car() //public class functions + Car(string newModel, int newYear, string newColor) + void setPrice(double newPrice) + void setYear(int newYear) + void setModel(int newModel) + double getPrice() const + int getYear() const + string getModel() const + void display() const |
Code the main function:
Write an program for NiftyGMC Dealer, which keeps track of their lot inventory. You may use either a vector of type Car to store all of the Car objects.
Your program will begin with an empty vector, and an empty Car object, and then the user will be allowed to perform any of of the following until he/she wishes to exit:
ADD add a Car to the Car inventory (user provides info on Car)
Code will set the contents of your Car object and push it at the end of the vector
PRINT - print out all Cars stored so far
Code will loop thru the vector .. remember, you can index each vector element
PRICE- accept a price from the user. Print out all Cars that are that price
YEAR ask the user for a year . print out all vehicles that were made that year
EXIT
* THE user will enter their choice (ADD,PRINT,PRICE,YEAR or EXIT) as a C-string. Before trying to identify the users choice, your program should check that the string contains only letters and is all upper case (you have functions to do this from week 10s project).
Week 10 project below
Week 10 C-strings and C-string functions
This week you are to code two functions, both which accept a C-string parameter and return information about the C-string.
bool AllLetters(char *text) //this function accepts one C-string parameter and returns true if all characters in the a text are letters.
void AllUpper(char* text) //this function accepts one C-string parameter containing all letters and setting all characters to upper case
Your main program will verify that these function work properly by:
* asking the user to enter some text without blanks
*print out the text
* while the text that the user entered does not contain only letters (use your function to check this)
Ask the user to enter some text without blanks
* print out the text
* update the text so that the first letter only is in upper case (use your function to update the text)
* print out the text
These functions will be used processing the user choice in the FINAL PROJECT, so you may wish to place them in a file separate from the main.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
