Question
Define a class based object called vehicleType in the VehicleTypeHeader.h file that contains the member variables listed below (20pts) : Variable name Description make model
Define a class based object called vehicleType in the VehicleTypeHeader.h file that contains the member variables listed below (20pts):
Variable name | Description |
make |
|
model | Type of vehicle |
year | Year of the vehicle |
price | Cost of the vehicle |
color | Color of the vehicle |
style | Coupe, sedan, SUV, truck, hatchback, etc. |
licensePlate | Vehicle license plate number |
type | New, used, certified |
The class should have the following constructors:
A default constructor that assigns the term "NA" to all string variable and 0 to the numerical variables.
A constructor that accepts values as arguments and assigns them to the appropriate member variables.
Write the appropriate mutator functions (setters) that store values in these member variables and accessor functions (getters) that return the values of the private member variables.
Include the additional member functions listed below:
printVehicleInfo: the member function does not take a parameter. The function displays information about a vehicle as shown below.
Make: Toyota
Model: RAV_4
Year: 2019 (used)
Price: $32158.99
== Style: SUV
== Color: Midnight_blue
== License plate number: 1234560
generateLicensePlate: the function does not take a parameter. The function should randomly generate a number between 1111111 and 9999999 and assign it to the license plate member variable.
/*PASTE CODE HERE -- The content of the VehicleTypeHeader.h file only*/
Exercise 2: Write the member function definitions for all member functions as described in Exercise 1 of the test to a file called VehicleTypeImp.cpp (20pts)
/*PASTE CODE HERE -- The content of the VehicleTypeImp.cpp file only*/
Exercise 3: Define a struct object called pointType to represent the decimal x and y coordinates on a plane. Write a driver function definition called distance that takes as its parameters two pointType objects. The driver function should find the distance between the two pointType objects and return a decimal value back to the calling function. To calculate the distance, use the distance formula below: (15pts)
*square rooted* (x21)^2+(21)^2.
/*PASTE CODE HERE -- just the function definition in the driver.cpp file */
Exercise 4: Write a driver function called searchVehicleInventory that takes a VehicleType array object and its size as parameters. The function should prompt the user for the year of the vehicle they are searching for and prints all the vehicles with the same year. If there is no vehicle made in the year in question, display the message "No vehicle produced in
/*PASTE CODE HERE -- just the function definition in the driver.cpp file */
Exercise 5: Write a driver function called insertionSort that takes an integer array and its size. The function should use the insertion sorting method to sort an array and count how many comparison operations were performed. The function should return the value back to the calling function. The function should not initialize an array, assume that the array has already been filled. (15pts)
**Note: This function does not have any relation to any part of the main function!!
/*PASTE CODE HERE */
Exercise 6: Write the tests to the VehicleType object to the driver.cpp file. Include only the necessary preprocessor directives, the driver function prototypes, the main function which includes the calls to the defined driver functions in exercise 4, and the driver function definitions themselves. To properly call the previously listed driver and member functions, the main function must declare all the appropriate variables as follows:
A VehicleType array that holds 8 vehicles stored in a file
Two pointType objects whose member values are provided by the user
File input (Note: the name of the file is called myVehicleList.txt)
Add a separate driver function definition to initialize the values of the VehicleType array object with values from a file (called initVehicleInvetory).
Copy and paste your code below and include a screenshot of a successful run on the program (40pts)
/*PASTE CODE HERE -- just the function definition in the driver.cpp file */
== myVehicleList.txt data ==
Toyota Camry 2012 15500 used Red Sedan
Subaru Outback_Premium 34500 certified Maroon Wagon
Honda CR-V_EXL 2016 25950 used Grey SUV
Lexus NX250_Premium 2022 new White SUV
Kia Sorento_SX 2016 22451 used Black SUV
Toyota Camry_Solara 2023 30494 used Red Coupe
Ford Mustang_GT 2022 43145 new Midnight_blue Sports_car
Alfa_Romeo Giulia_Ti 2022 44945 certified Silver Sedan
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