Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Explanation / Answer

class vehicle { private: string type; string name; int year; double rank; public: //Constructor that will set information for a new car void New_vehicle (string a, string b, int c , double d) {type = a; name = b; year = c; rank = d;} Vehicle(); //Default constructor Vehicle(string, string, int, double); //mutator and accessor functions void setType(string); void setName(string); void setYear(int); void setRank(double); string getType(); string getName(); int getYear(); double getRank(); //Check rank to see if valid void valid_rank(int); //virtual function virtual void decide() { } }; //Sets to default values Vehicle::Vehicle() { type = " "; name = " "; year = 0; rank = " "; } // My Vehicle set up(type,name,year,rank) Vehicle::Vehicle(string type, string name, int year, string rank) { Vehicle::type = type; Vehicle::name = name; Vehicle::year = year; Vehicle::rank = rank; } void Vehicle::settype(string type) { Vehicle::type = type; } void Vehicle::setname(string name) { Vehicle::name = name; } void Vehicle::setYear(int year) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote