Project 3
#include
using namespace std;
#define size 2
#define MAXKM 50000
class vehicle
{
public:
string make, model,type;
enum TYPE{GAS,ELECTRIC,DIESEL};
int year;
float odometer;
virtual void setmake();
virtual void putmake();
virtual void setmodel();
virtual void putmodel();
virtual void setyear();
virtual void putyear();
virtual void setodometer();
virtual void putodometer();
};
void vehicle::setmake()
{
cout<<"Enter make of the vehicle"< cin >> make; } void vehicle::putmake() { cout<<"\t"< } void vehicle::setmodel() { cout<<"\n Enter model of the vehicle"< cin >> model; } void vehicle::putmodel() { cout<<"\t"< } void vehicle::setyear() { cout<<"\n Enter manufactured year of the vehicle"< cin >> year; } void vehicle::putyear() { cout<<"\t"< } void vehicle::setodometer() { cout<<"\n Float data speedometer of the vehicle"< cin >> odometer; } void vehicle::putodometer() { cout<<"\t"< if(odometer>50000) cout<<"\n Tyre Rotation to be done "< else cout<<" \n Less than 50000 KMS -Type rotation can be done in next visit."< } void menudisplay() { cout << "0.Quit.\n"; cout<< "1. displayservices.\n"; cout<< "2. Add vehicle.\n"; } void displayservices() { cout<<"\n oil change or replace oil filter, repalce air filter"< cout<<"replace fuel filter, tire rotations, infotainment debug"< cout<<"replace spark plugs, replace the cabin filter, check the level"< cout<<"refill clutch fluid"< cout<<"brake fluid, examine belts, wipers, hoses"< cout<<"check the tire conditioins, check the charging systems, battery"< } int main() { int user_choice; beginning: menudisplay(); cout<<"Enter your choice in no"< cin >> user_choice; switch(user_choice) { case 0 :cout <<"Exiting the program "; break ; case 1 : displayservices(); goto beginning; case 2: vehicle *pv=new vehicle(); pv->setmake(); pv->setmodel(); pv->setyear(); pv->setodometer(); pv->putmake(); pv->putmodel(); pv->putyear(); pv->putodometer(); goto beginning; } } output of the programme is 0.Quit 1. disp;ayservices 2. Add vehicle enter your choice is no. 1 oil change or replace oil filter , replace air filter replace fuel filter, tire rotations, infotaiinment debug replace spark plugs, replace the cabin filter, check the level refill clutch fluid brake fluid, examine belts , wipers , hoses check the tire condition , check the charging systems, battery now after that enter the choice in no. 2 get enter make of the vehicle after that press the 0 get enter model of the vehicle after that [ress 1 get enter manufactured year of the vehicle