Project 2
Project2:
Coding:
#include<iostream>//library
using namespace std;
enum Type{GAS,DIESEL,ELECTRIC};//enum type list for the vechile
class automobile_maintenance//main class for the automobile maintenance
{
protected://it is a protected function in class
string make,model;
int year,odometer,type;
public://used to access the protected in main class
automobile_maintenance()//constructor details of the vehicles
{
cout<<"The make of the vehicle"<<endl;
cin>>make;
cout<<"The model of the vechical"<<endl;
cin>>model;
cout<<"The manufacturing year of vehicle"<<endl;
cin>>year;
cout<<"The odometer reading in the vehicle"<<endl;
cin>>odometer;
cout<<"The VEHICLE TYPE to choose\n choose 0 for GAS type\n choose 1 for DIESLE type choose 2 for ELECTRIC type"<<endl;
cin>>type;
}
};
class maintenance : public automobile_maintenance
{ protected://it is a protected function in class
int t,c;
public://used to access the protected in main class
void checkTireRotation()//constructor details of the vehicles
{
cout<<"The information based on the tire rotation is: "<<endl;
if(odometer >= 50000)
{
cout<<"The car tire must be changed the life time is over"<<endl;
}
else
{
t=(50000-odometer);
cout<<"The tires is good condition \n After"<<t<<"kms the tier must be changed"<<endl;
}
}
void checkChargerPower()
{
cout<<"The information based on the battery usage: "<<endl;
if(odometer >= 400)
{
cout<<"The battery must need be changed"<<endl;
}
else
{
c=(400-odometer);
cout<<"The battery is in good condition \n After"<<c<<"kms the battery must be changed"<<endl;
}
}
};
class car : public automobile_maintenance
{
protected://it is a protected function in class
int n; //declare n
public://used to access the protected in main class
void fun()//constructor details of the vehicles
{
cout<<"The information based on the customer vehicle: "<<endl; // display the statement on the console
cin>>n; // user's input value
switch (n) //switch case of n
{
case 0:
cout<<"GAS type vehicle came to service"<<endl;
cout<<"It runs in liquidfied gas"<<endl;
break;
case 1:
cout<<"DIESEL type vehicle came to service"<<endl;
cout<<"It runs in liquid petrolium"<<endl;
break;
case 2:
cout<<"ELECTICAL type vehicle came to service"<<endl;
cout<<"It runs in rechargeable battery"<<endl;
break;
default:
cout<<"Invalid type of vehicle to select"<<endl;
break;
}
}
};
//main function created object to call the class and access the member function to display the output
//object created for each and every function to call the class
int main()
{
maintenance m;
car c;
m.checkTireRotation();
m.checkChargerPower();
c.fun();
//the list where the company changed in the vehicle and according to the coustomerlist
int y; // declare y
cin>>y; // user's input value
switch(y)
{
case 0:
cout<<"Thanks for doing service with us "<<endl;
cout<<"Have a safe journey"<<endl;
break;
case 1:
cout<<"The list of the inventory details have been uploaded in a proper manner"<<endl;
cout<<"The list has been got approved from RTO"<<endl;
break;
case 2:
cout<<"If you want to add the another vehicle bill means we can add it"<<endl;
cout<<"you said no need ok"<<endl;
break;
case 3:
cout<<"The old parts has been replaced with the updated parts in the market"<<endl;
cout<<"Its an wonderful update in the year"<<endl;
break;
case 4:
cout<<"There is no vehicle is added in the list to remove"<<endl;
break;
case 5:
cout<<"The rotation is in good condition"<<endl;
cout<<"there is no need to change the tire"<<endl;
break;
case 6:
cout<<"The oil tank in the car cleaned completely"<<endl;
cout<<"the new oil is filled in the tank"<<endl;
break;
case 7:
cout<<"As per the customer requirement the battery has changed to new version"<<endl;
cout<<"The battery recharged fully and it has 2 year life time"<<endl;
break;
}
}
Output:
The make of the vehicle
Toyota
The model of the vechical
Corolla
The manufacturing year of vehicle
2014
The odometer reading in the vehicle
30000
The VEHICLE TYPE to choose
choose 0 for GAS type
choose 1 for DIESLE type choose 2 for ELECTRIC type
1
The make of the vehicle
BMW
The model of the vechical
X1
The manufacturing year of vehicle
2022
The odometer reading in the vehicle
52000
The VEHICLE TYPE to choose
choose 0 for GAS type
choose 1 for DIESLE type choose 2 for ELECTRIC type
0
The information based on the tire rotation is:
The tires is good condition
After20000kms the tier must be changed
The information based on the battery usage:
The battery must need be changed
The information based on the customer vehicle:
0
GAS type vehicle came to service
It runs in liquidfied gas
0
Thanks for doing service with us
Have a safe journey