Write a C++ Program, there are no predefined choices, program asks for values th
ID: 645239 • Letter: W
Question
Write a C++ Program, there are no predefined choices, program asks for values that are allowed, user enters values and if not within range display error.
write a C++ source file with the
Class name: Vehicle.
It has private attributes
Car Type (string)
Car Name (string)
Car Year (int) 1 = 1970, 2 = 1980, 3 = 1990, 4= 2000;
Car Rank (double) 0.0-4.0
the Public Member Functions:
1) Public Constructors
- a default constructor with no paramaters
-a constructor with paramaters, one paramater for each attribute.
2) Public Member Functions
- set() method for setting value of each attribute
-The set() method for car year - before assigning the incomin value, check to see if the incoming value is 1, 2, 3, 4. If its not, assign 0, and print to screen, value not legal.
- a get() method for each attribute.
- a method called Decide, to decide if car is worthy to purchase. Following this: If car is 2000 and rank is 3.8 or higher, return a true value for granting worthyness to purchase. Otherwise return false value, that means car is not worthy to purchase.
In the same source file write the main() function.
1) create 2 specific Vehicle objects, use object names c1 and c2, giving them specific attribute values. Either through constructor with paramaters, or through set statements after they are created.
2) For each vehicle, retrieve and display the full information using the get() methods and display whether this car is worthy purchase via the Decide method.
The year is entered by User with 1,2,3,4 and its rank 0.0 - 4.0 is entered by user.
I will award best answer to whomever does this correctly.
Thank you