Professional Documents
Culture Documents
SOURCE CODE :
#include <iostream>
#include <string.h>
using namespace std;
class vehicle{
protected:
double mileage, price;
public:
vehicle(){
cout << "CLASS :: vehicle ( defualt constructor )" << endl;
}
double Miles(int a);
double VehiclePrice(int b);
};
string FuelType(){
string f;
cout << "Fuel type (petrol, diesel): ";
cin >> f;
fuel = f;
return fuel;
}
void car_info();
};
bike(){
cout << "CLASS :: bike ( defualt constructor )" << endl;
}
string Cooling_Type(){
string ct;
cout << "Cooling Type (air, liquid, oil) : ";
cin >> ct;
coolingType = ct;
return coolingType;
}
string Wheel_Type(){
string wt;
cout << "Wheel type (Alloy, Spokes) : ";
cin >> wt;
wheelType = wt;
return wheelType;
}
void bike_info();
};
class Honda: public car{
public:
int model;
Honda(){
cout << "CLASS :: Honda ( defualt constructor )" << endl;
}
string setmakeType(){
string g;
cout << "Make type of a bike : ";
cin >> g;
makeType = g;
return makeType;
}
void bike_info(){
cout <<"\n\nYamaha Bike Information\n";
cout << "Price : Rs. " << price << endl;
cout << "Mileage : " << mileage <<" km "<< endl;
cout << "Cylinders : " << cylinders <<endl;
cout << "Gears : " << gears << endl;
cout << "Fuel tank size : " << fuelTank_size << endl;
cout << "Cooling Type (air, liquid, oil) : " << coolingType <<endl;
cout << "Wheel type (Alloy, Spokes) : " << wheelType << endl;
cout << "Make type : " << makeType;
cout << "\n\n";
}
};
string setmakeType(){
string g;
cout << "Make type of a bike : ";
cin >> g;
makeType = g;
return makeType;
}
void bike_info(){
cout <<"\n\nTVS Bike Information\n";
cout << "Price : Rs. " << price << endl;
cout << "Mileage : " << mileage <<" km "<< endl;
cout << "Cylinders : " << cylinders <<endl;
cout << "Gears : " << gears << endl;
cout << "Fuel tank size : " << fuelTank_size << endl;
cout << "Cooling Type (air, liquid, oil) : " << coolingType <<endl;
cout << "Wheel type (Alloy, Spokes) : " << wheelType << endl;
cout << "Make type : " << makeType;
cout << "\n\n";
}
};
int main(){
int x;
int y;
do{
cout << "Select option for information"<<endl;
cout << "1. HONDA \n";
cout << "2. COROLLA\n";
cout << "3. YAMAHA\n";
cout << "4. TVS Bike\n";
cout << "5. EXIt\n";
cout << "\n SELECT FROM 1 - 5 :: ";
cin >>x;
switch(x){
case 1:{
Honda h;
h.VehiclePrice(150000);
h.Miles(25000);
h.Cost_of_Ownership(60000);
h.Car_warranty(3);
h.total_seats(5);
h.FuelType();
h.setmodel(19);
h.car_info();
break;
}
case 2:{
corolla c;
c.VehiclePrice(140000);
c.Miles(25000);
c.Cost_of_Ownership(450000);
c.Car_warranty(5);
c.total_seats(5);
c.FuelType();
c.setmodel(19);
c.car_info();
break;
}
case 3:{
Yamaha y;
y.VehiclePrice(90000);
y.Miles(1600);
y.fuelTankSize(12);
y.Cooling_Type();
y.totalCylinders(2);
y.Wheel_Type();
y.totalgear(5);
y.setmakeType();
y.bike_info();
break;
}
case 4:{
TVS a;
a.VehiclePrice(70000);
a.Miles(30000);
a.fuelTankSize(14);
a.Cooling_Type();
a.totalCylinders(3);
a.Wheel_Type();
a.totalgear(5);
a.setmakeType();
a.bike_info();
break;
}
}while(x<=4);
return 0;
OUTPUT :