Challenge

Project 3

ABINAYA MAM BATCH

#include <iostream>

using namespace std;

class vehicle//base/Parent class is vehicle
{
public:
// vehicle();
//~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();

};//derived/child classes
void vehicle::setmake()
{
cout<<"Enter make of the vehicle"<<endl;
cin>>make;
}
void vehicle::putmake()
{
cout<<"\t"<<make;
}
void vehicle::setmodel()
{
cout<<"\nEnter model of the vehicle"<<endl;
cin>>model;
}
void vehicle::putmodel()
{
cout<<"\t"<<model;
}
void vehicle::setyear()
{
cout<<"Enter the manufactured year of the vehicle"<<endl;
cin>>year;
}
void vehicle::putyear()
{
cout<<"/t"<<year;
}
void vehicle::setodometer()
{
cout<<"\nFloat data speedometer of the vehicle"<<endl;
cin>>odometer;
}
void vehicle::putodometer()
{
cout<<"\t"<<odometer;
if(odometer>50000)
cout<<"\nTyre Rotation need to be done";
else
cout<<"\nLess than 50000 KMS-Tyre Rotation can be done in next visit"<<endl;
}
void menudisplay()
{
cout<<"0. Quit\n";
cout<<"1. displayservices\n";
cout<<"2.Add vehicle\n";
}
void displayservices()
{
cout<<"\noil change or replace oil filter,replace air filter"<<endl;;
cout<<"\nreplace fuel filter,tyre rotations,infotainment debug"<<endl;
cout<<"\nreplace spark plugs,replace the cabin filter,check the level "<<endl;
cout<<"\nbrake fluid,examine belts,wipers,hoses"<<endl;
cout<<"\nrefill clutch fluid,"<<endl;
cout<<"check the tyre condition,check the charging systems,battery"<<endl;
}
int main()
{
int user_choice;
beginning:menudisplay();
cout<<"Enter your choice in no:"<<endl;
cin>>user_choice;
switch(user_choice)
{
case 0:cout<<"Exiting the progarm";
break;
case 1:displayservices();
goto beginning;//the goto statement is used for altering the normal
//sequence of program execution by transferring control to some other part of the program.
case 2:
vehicle *pv=new vehicle();
pv->setmake();
pv->setmodel();
pv->setyear();
pv->setodometer();
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.