Challenge

Project 2

#include <iostream>

using namespace std;

#define size int32_t

#define MAXX 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 setodmeter();

virtual void putodometer();

};

void vehicle::setmake()

{

cout<<"enter make of the vehicle"<<endl;

cin>>make;

}

void vehicle::putmake()

{

cout<<"\t"<<make;

}

void vehicle:: setmodel ()

{

cout<<"\n enter model of the vehicle " << endl;

cin >> model;

}

void vehicle:: putmodel()

{

cout<<"\t " << model;

}

void vehicle :: setyear()

{

cout<<"\n enter manufactured year of the vehicle"<<endl;

cin >> year;

}

void vehicle:: putyear()

{

cout<<"\t"<<year;

}

void vehicle::setodmeter()

{

cout<<"\n floaat data speedometer of the vehicle"<<endl;

cin >> odometer;

}

void vehicle::putodometer()

{

cout<<"\t"<<odometer;

if(odometer>55000)

cout<<"\n tyre rotation to be done"<< endl;

else

cout<<"\n less than 50000 KMS- type rotationcan be done next visit."<<endl;

}

void menudisplay()

{

cout << "0. quit. \n";

cout << "1. display service.\n";

cout << "2. add vehicle. \n";

}

void displayservice()

{

cout<<"\n all change or replace oil filter, replace aie filter"<<endl;

cout<<"replace fuel filter, tire rotations, infotainment debug"<<endl;

cout<<"replace spark plugs, replace the cabin filters, check the level"<<endl;

cout<<"refill clutch fluid"<<endl;

cout<<"brake fluid, examine belts, wipers, hoses"<<endl;

cout<<"check the tire conditions, check the charging systems, battery"<<endl;

}

int main()

{ int user_choice;

beginning: menudisplay();

cout<<"enter your choice is no"<<endl;

cin >> user_choice;

switch(user_choice)

{

case 0 :cout << "exiting the program";

break;

case 1 : displayservice();

goto beginning;

case 2:

vehicle *pv=new vehicle();

pv-> setmake();

pv-> setmodel();

pv-> setyear();

pv-> setodmeter();

pv-> putmake();

pv-> putmodel();

pv-> putyear();

pv-> putodometer();

goto beginning;

}

}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.