Challenge

Project 3

#include<iostream>
#include<string>

using namespace std;
class Vehicle
{
protected:
string Make1,Make2,Make3,Model1,Model2,Model3;
int year,odometer,remainde;
public:
enum Type{GAS,DIESEL,ELECTRIC};
Vehicle(string &a,string &b,string &c,string &d,string &e,string &f,int i,int J):Make1(a),Make2(b),Make3(c),Model1(d),Model2(e),Model3(f),year(i),odometer(J)
{

}
string newgetMake();

void setMake();

string newgetModel();

void setModel();

void newgetyear();

void setyear();

int newgetodometer();

void setodometer();
};
class Gascar
{
public:
void getType();
void getFuelType();
};
class DieselCar
{
public:
void getType();
void getFuelType();
};
class ElectricCar
{
public:
void checkTireRotation();
void checkChargePower();
void getType();
};
class FuelVehicle
{public:
void checkoil();
void getfuelType();
};
void Vehicle::setMake()
{
cout<<"Retriving yourcar maker data..."<<endl;
}
string Vehicle::newgetMake()
{
cout<<"the maker of the car is"<<endl<<"1."<<Make1<<endl<<"2."<<Make2<<"3."<<Make3<<endl;
}
void Vehicle::setModel()
{
cout<<"Retriving your car model data..."<<endl;
}
string Vehicle::newgetModel()
{
cout<<"the model is "<<" "<<"1."<<Model1<<" "<<"2."<<Model2<<" "<<"3."<<Model3<<endl;
}
void Vehicle::setyear()
{
cout<<"retriving your Car's Manufacturing year "<<endl;
}
void Vehicle::newgetyear()
{
cout<<"The year of the car is"<<year<<endl;
}
void Vehicle::setodometer()
{
cout<<"Retriving your car's odometer reading..."<<endl;
}
int Vehicle :: newgetodometer()
{
return odometer;
}
void Gascar::getType()
{
cout<<"Retriving your car Type...."<<endl;
}
void Gascar :: getFuelType()
{
string f={"LPG"};
cout <<"The fuel Type is "<<""<<f<<endl;
}
void DieselCar :: getType()
{
}

void DieselCar :: getFuelType()
{
string D={"Diesel"};
cout <<"Your car Type is "<<""<<D<<endl;
}
void ElectricCar::checkTireRotation()
{
int c,d;
cout<<"Retrieving data from vehicle..."<<endl<<"You have travelled..."<<endl;
cin>>d;
if (d>50000)
cout<<"change tire"<<endl;
else
cout<<"You are good to go"<<endl;
}
void ElectricCar::checkChargePower()
{
int d;
cout<<"enter the distance your car traveled"<<endl;
cin>>d;
if(d>=400)
{
cout<<"Battery need to be recharge"<<endl;
}
else
cout<<"You are ready to go";
}
void ElectricCar::getType()
{
string s={"Electric Vehicle"};
cout<<"Retrieving your car fuel type"<<endl;
cout<<"your car's fule type is"<<s<<endl;
}
void FuelVehicle::checkoil()
{
int oillimit;
cout<<"Retrieving data of your car's oil limit"<<endl;
cin>>oillimit;
cout<<"your car has"<<oillimit<<"% oil left"<<endl;
}
void FuelVehicle :: getfuelType()
{
string F;
cout<<"Retreiving your car's Fuel type data";
cin>>F;
cout<<"The fuel type of car is"<<F<<endl;
}
class maintanance
{
public:
int distance, battery;
string inventory={"Tata,Maruthi,Benz"};
void quit()
{
cout<<"Thanks for visiting us";
}
void list_inventory()
{
cout<<"Welcome to your inventory"<<endl;
cout<<"The vehicle lists in your inventory is:"<<inventory<<endl;
}
void Add_vehicle()
{
string Vehicle4,Make4,Model4;
int year4;
cout<<"Enter the vehicle you want to add"<<endl;
cin>>Vehicle4;
cout<<"Enter the makers of the car"<<endl;
cin>>Make4;
cout<<"Enter the model of the car"<<endl;
cin>>Model4;
cout<<"Enter the year of manufacturing"<<endl;
cin>>year4;
inventory=inventory+""+Vehicle4;
cout<<"you have successfully updated your inventory"<<endl;
cout<<"New car adeed:"<<Vehicle4<<endl<<"Make of the car"<<Make4<<endl<<"Model of the car"<<Model4<<endl<<"year of the car"<<year4<<endl;
}
void update_Vehicle()
{
cout<<"Your updated vehicle is:"<<inventory<<endl;
}
void Remove_Vehicle()
{
string word;
cout<<"The enter the car you want to delete"<<endl;
cin>>word;
int pos=inventory.find(word);
if(pos!=string::npos)
{
inventory.erase(pos,word.length()+1);
cout<<"The upated inventory"<<""<<inventory<<endl;
}
else
cout<<"The vehicle is not found"<<endl;
}
void Tire_Rotation()
{
int distance,d;
cout<<"Enter the distance";
cin>>distance;
if(distance>=50000)
cout<<"change tire"<<endl;
else
cout<<"You are good to go"<<endl;
}
void Oilchange()
{
int oil;
cout<<"Enter the oil limit of the vehicle";
cin>>oil;
if(oil<20)
cout<<"Oil needs to be changed"<<endl;
else
cout<<"You are good to go"<<endl;
}
void recharge()
{
int Battery;
cout<<"Enter the chargeing of the vehicle";
cin>>Battery;
if(Battery<20)
cout<<"Vehicle should be charge"<<endl;
else
cout<<"You are good to go"<<endl;
}
};

int main()
{
int n,year,odometer;
string Make1,Make2,Make3,Model1,Model2,Model3;
cout<<"Retrive the data from user"<<endl;
cout<<"We are trying to retrieve data for the Make,Model1,Year of manufacturing Datas"<<endl;
cout<<"Enter the Makes of 3 Vehicles"<<endl;
cin>>Make1>>Make2>>Make3;
cout<<"Enter the Model of 3 Vehicles"<<endl;
cin>>Model1>>Model2>>Model3;
cout<<"Enter the Manufacturing Year";
cin>>year;
cout<<"Enter odometer Reading"<<endl;
cin>>odometer;
Vehicle V(Make1,Make2,Make3,Model1,Model2,Model3,year,odometer);
Gascar G;
DieselCar D;
ElectricCar E;
FuelVehicle F;
maintanance M;
cout<<"menu is follows"<<endl;
cout<<"0.Quit"<<endl<<"1.List inventory"<<endl<<"1.Add vehicle"<<"2.Update Vehicle"<<endl<<"3.Remove vehicle"<<endl<<"4.Oil change"<<endl<<"5.recharge"<<endl<<"6.Distance"<<endl<<"7.tirerotation"<<endl;
cout<<"Enter the choice you want"<<endl;
cin>>n;
switch(n)
{
case 0:
cout<<"Youn have choosen option 0"<<endl;
M.quit();
//break;
case 1:
cout<<"Youn have choosen option 1"<<endl;
M.list_inventory();
V.setMake();
V.newgetMake();
V.setModel();
V.newgetModel();
V.setyear();
V.newgetyear();
//break;
case 2:
cout<<"you have chosen option 2"<<endl;
M.Add_vehicle();

//break;
case 3:
cout<<"you have chosen option 3"<<endl;
M.update_Vehicle();

//break;
case 4:
cout<<"you have chosen option 4"<<endl;
M.Remove_Vehicle();
//break;
case 5:
cout<<"you have chosen option 5"<<endl;
V.setodometer();
V.newgetodometer();
M.Tire_Rotation();
//break;
case 6:
cout<<"you have chosen for oil change"<<endl;
M.Oilchange();
//break;
case 7:
cout<<"you have chosen option 7"<<endl;
M.recharge();
break;
}
int i;
cout<<"Enter the Type of vehicle you want the details"<<endl;
cout<<"1. Gas Type "<<endl<<"2. Diesel Type"<<endl<<"3.Electric Type"<<endl<<"4.Fule Type"<<endl;
cin>>i;
switch(i)
{
case 1:
G.getType();
G.getFuelType();
break;
case 2:
D.getType();
D.getFuelType();
break;
case 3:
E.getType();
E.checkTireRotation();
E.checkChargePower();
break;
case 4:
F.checkoil();
F.getfuelType();
break;
}
return 0;
}

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.