Question
In C++... Program 2 (50 Points) - 1) Create a struct for a Car. This new struct should have variables inside it to hold Make,
In C++...
Program 2 (50 Points) -
1) Create a struct for a Car. This new struct should have variables inside it to hold Make, Model, Color, Year, Mileage, and VIN. (Page 602 has an example of one for PayRoll if you need one to go by. It has 5 internal variables, yours for the Car will have 6.)
2) Create the following car data in one array of your Car structure (set these values with an initialization list or otherwise set the values inside the program.) You may also use a vector of the new Car structure if you would like. In either case you should have one and only one array (or vector) that holds all of the information below as each element in it is an entire cars data:
Make Model Color Year Mileage VIN
1. Porsche 911 Silver 2005 18990 1237362
2. Ford Mustang Red 2007 49842 7337372
3. Chevrolet Beretta Black 1989 90332 2873644
4. Ford Focus White 2008 150 9236498
5. Voltzwagon Jetta Black 2006 28002 4673992
6. Rolls Royce Ghost Silver 2005 10000 9292983
7. Mazda 626 Blue 2002 84754 7364646
8. Toyota Camry Red 2004 50332 2133737
9. <
2) Write a loop to display all of the car data inside the array for the user.
3) Write the code to ask the user for a car position to change, and then ask the user for the year and mileage to change the car data in that position to. Change the values of this car and redisplay the cars for the user to show the change to the structure at that position in your array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started