Question: c++ need help asap please! 19.3 LAB: Class problem Write a C++ program for a Vehicle class. You must declare and define this class and
19.3 LAB: Class problem Write a C++ program for a Vehicle class. You must declare and define this class and write the complete program to achieve the following specifications All objects of the Vehicle class would have a Boolean type of variable for status (1 for new, O for old), a string for make and model (single string common for both make and model), a double for total number of miles on the odometer and an integer for claimed miles per gallon These would be the data members of the class - Write a default constructor that creates a Vehicle object and sets the status of the vehicle to old make and model of the vehicle to "Morris Minor" , total number of miles to 150000.90 and miles per gallon to 20. This constructor should be defined outside the class declaration - Write an overloaded constructor that creates a Vehicle object with data member values specified at the time of object creation. This constructor should be defined outside the class declaration - Write a private member function gasConsumed() that calculates and returns the total gas consumed in gallons by the vehicle in the lifetime. This can be calculated using the odometer reading and the claimed miles per gallon This could be an inline function Write a public member function printDetails() that prints the status, make and model total number of miles in the odometer, claimed miles per gallon and the total amount of gas consumed by the vehicle in its lifetime (obtained by calling gasConsumed()). In the same sequence as specified, separated by spaces. This function should be defined outside the class declaration Any fractional values should be printed with only two digits after the decimal point. As an example, if the function were called for an object created using the default constructor, the output would be O Morris Minor 150000.90 20 7500.05 - In the main() function * create an object, uting the overloaded constructor for a new vehicle with these particulars status new make and model = "Dodge Charger total number of miles - 65000 25, claimed miles per gallon 24 # call the printDetails () member function of the vehicle class for the object created by the overloaded constructor in the previous step Please understand that more posting of tests will not endure you all the points. You will be eligible for any/all the points only if the code has been written by you as per the specification above LAD ACTIVITY 193.1. LAB Class problem 0/1 main.cpp Load default template 1 include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
