Project 3
(1).
#include
using namespace std;
class vehicle{
public:
int year,odometerreading;
string make,model;
enum Type{
GAS,DIESEL,ELECTRIC
};
enum Type type;
void getNewMake();
void getNewModel();
void getYear();
void getNewOdometer();
void setNewmake();
void setNewmodel();
void setYear();
void setNewodometer();
};
class Gascar{
string getType();
string getFuelType();
};
class DieselCar{
string getType();
string getFuelType();
};
class ElectricCar{
public:
string checkTireRotation(int odometerreading){
if(odometerreading>=50000){
return "replace the tires";
}
else{
return "tires are good to go";
}
}
string checkChargerPower(int odometerreading){
if(odometerreading==400){
return "battery to be recharged";
}
else{
return "your vehicle is good to go";
}
}
string getType(){
return "fuel type";
}
};
class FuelVehicle{
virtual void getFuelType()=0;
void checkOil()
{
char input;
cout<<"enter whether oil needs replacement"<
if(input=='Y')
{
cout<<"Oil is replaced"<
else
{
cout<<"Oil is not replaced"<
}
};
string Gascar::getType()
{
return "the type of car is Gascar";
}
string Gascar::getFuelType()
{
return "the type of car is LPG Gas";
}
string DieselCar::getType()
{
return "the type of car is DieselCar";
}
string DieselCar::getFuelType()
{
return "the type of car is Diesel";
}
class Maintanence
{
public:
string inventory={"benz,audi,tata,xuv"};
void addVehicle()
{
string x;
cout<<"enter the car needs to be added"<
inventory=x+" "+inventory;
cout<
void listvehicle(){
cout<
void updatevehicle(){
cout<
void removevehicle(){
string re;
int pos;
cout<<"enter the vehicle to be remove"<
pos=inventory.find(re);
if(pos!=string::npos){
inventory.erase(pos,re.length()+1);
cout<
else{
cout<<"vehicle is not found"<
}
void checkTireRotation(){
int odometerreading;
cout<<"enter the odometer reading"<
if(odometerreading<=50){
cout<<"replace the tires"<
else{
cout<<"tires are good to go"<
}
void checkOil()
{
char input;
cout<<"enter whether oil needs replacement"<
if(input=='Y')
{
cout<<"Oil is replaced"<
else
{
cout<<"Oil is not replaced"<
}
void checkChargerPower(){
int odometerreading;
cout<<"enter the odometer reading"<
if(odometerreading==400){
cout<<"battery to be recharged"<
else{
cout<<"your vehicle is good to go"<
}
};
void vehicle::setNewmake(){
cout<<"Enter the make of the car"<
};
void vehicle::getNewMake(){
cout<
void vehicle::setNewmodel(){
cout<<"the model of the car"<
};
void vehicle::getNewModel(){
cout<
void vehicle::setYear(){
cout<<"the manufacture year of the car"<
};
void vehicle::getYear(){
cout<
void vehicle::setNewodometer(){
cout<<"the reading of the car"<
};
void vehicle::getNewOdometer(){
cout<
int main(){
int year,odometer;
string make,model;
vehicle v;
Gascar g;
DieselCar d;
ElectricCar e;
Maintanence m;
FuelVehicle *f;
v.setNewmake();
v.getNewMake();
v.setNewmodel();
v.getNewModel();
v.setYear();
v.getYear();
v.getNewOdometer();
v.setNewodometer();
int choice;
while(1){
cout<<"enter the choice"<
switch(choice){
case 1:
m.addVehicle();
break;
case 2:
m.listvehicle();
break;
case 3:
m.updatevehicle();
break;
case 4:
m.removevehicle();
break;
case 5:
m.checkTireRotation();
break;
case 6:
m.checkOil();
break;
case 7:
m.checkChargerPower();
break;
default:
cout<<"exit"<
}
return 0;
}