Challenge

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"<cin>>input;
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"<cin>>x;
inventory=x+" "+inventory;
cout<}
void listvehicle(){
cout<}
void updatevehicle(){
cout<}
void removevehicle(){
string re;
int pos;
cout<<"enter the vehicle to be remove"<cin>>re;
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"<cin>>odometerreading;
if(odometerreading<=50){
cout<<"replace the tires"<}
else{
cout<<"tires are good to go"<}
}
void checkOil()
{
char input;
cout<<"enter whether oil needs replacement"<cin>>input;
if(input=='Y')
{
cout<<"Oil is replaced"<}
else
{
cout<<"Oil is not replaced"<}
}
void checkChargerPower(){
int odometerreading;
cout<<"enter the odometer reading"<cin>>odometerreading;
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"<cin>>make;
};
void vehicle::getNewMake(){
cout<};
void vehicle::setNewmodel(){
cout<<"the model of the car"<cin>>model;
};
void vehicle::getNewModel(){
cout<};
void vehicle::setYear(){
cout<<"the manufacture year of the car"<cin>>year;
};
void vehicle::getYear(){
cout<};
void vehicle::setNewodometer(){
cout<<"the reading of the car"<cin>>odometerreading;
};
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"<cin>>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;
}

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.