#include<iostream>
using namespace std;
class Car{
private:
string licenceNumber;
string Model;
double currentMileage;
int engineSize;
public:
void setLicense(string l){
licenceNumber = l;
}
void setModel(string m){
Model = m;
}
void setCurrentMileage(double l){
currentMileage = l;
}
void setEngine(int l){
engineSize = l;
}
string getLicence(){
return licenceNumber;
}
string getModel(){
return Model;
}
double getCurrent(){
return currentMileage;
}
int getEngineSize(){
return engineSize;
}
};
class Main{
private:
Car c[10];
public:
void input(){
cout<<"Enter the details for the cars:\n";
for(int i=0; i<10; i++){
cout<<"Enter the car license number";
string license;
cin>>license;
cout<<"Enter the car model: \n";
string model;
cin>>model;
cout<<"Enter the current milleage:\n";
double mileage;
cin>>mileage;
cout<<"Enter the car engine size:\n";
int engine;
cin>>engine;
c[i].setLicense(license);
c[i].setModel(model);
c[i].setEngine(engine);
c[i].setCurrentMileage(mileage);
}
}
void output(){
cout<<"The details stored are: "<<endl;
for(int i=0; i<10; i++){
cout<<"License Number: "<<c[i].getLicence()<<endl;
cout<<"Model: "<<c[i].getModel()<<endl;
cout<<"Current Mileage: "<<c[i].getCurrent()<<endl;
cout<<"Engine Size: "<<c[i].getEngineSize()<<endl;
}
}
};
int main(){
}
Comments
Leave a comment