rendered paste body#include <iostream>#include <string>#include <stdlib.h>using namespace std;char* charphone(long);char itoa(long);class Vehicle{private: char make[40]; char model[40]; char lp[7]; char color[10]; int doors; int makeyear; int hp; int cylinders; int enginvol;public: /*Constructors*/ Vehicle(); Vehicle(char[],char[],char[],char[],int,int,int,int,int); /*Get methods*/ char* getMake(); char* getModel(); char* getLp(); char* getColor(); int getDoors(); int getMakeyear(); int getHp(); int getCylinders(); int getEnginvol(); /*Set methods tou programmatisti*/ void setVehicle(char[],char[],char[],char[],int,int,int,int,int); void setMake(char[]); void setModel(char[]); void setLp(char[]); void setColor(char[]); void setDoors(int); void setMakeyear(int); void setHp(int); void setCylinders(int); void setEnginvol(int); /*Input methods tou xristi*/ void inputVehicle(); void inputMake(); void inputModel(); void inputLp(); void inputColor(); void inputDoors(); void inputMakeyear(); void inputHp(); void inputCylinders(); void inputEnginvol(); /*Other methods*/ void printVehicle(); bool checkLp(); bool checkChar(char);};class Employee{private: char name[30]; char address[40]; long phone; char afm[10]; Vehicle myCar;public: Employee(); Employee(char *, char *, long, char *, Vehicle); void setEmployee(); void setEmployee(char *, char *, long, char *, Vehicle); void setName(char *); void setAddress(char *); void setPhone(long); void setAfm(char *); void setMyCar(Vehicle); void inputEmployee(); void inputName(); void inputAddress(); void inputPhone(); void inputAfm(); char* getName(); char* getAddress(); long getPhone(); char* getAfm(); Vehicle getmyCar(); void printEmployee();};Employee::Employee(){ strcpy(name,""); strcpy(address,""); phone = 0; strcpy(afm,""); myCar = Vehicle();}Employee::Employee(char* a, char* b, long c, char* d, Vehicle Car){ strcpy(name, a); strcpy(address, b); phone = c; strcpy(afm, d); myCar = Car;}void Employee::setEmployee(char* a, char* b, long c, char* d, Vehicle Car){ strcpy(name, a); strcpy(address, b); phone = c; strcpy(afm, d); myCar = Car;}void Employee::setEmployee(){ strcpy(name,""); strcpy(address,""); phone = 0; strcpy(afm,""); myCar.inputVehicle();}void Employee::setName(char* a){ strcpy(name, a);}void Employee::setAddress(char* a){ strcpy(address, a);}void Employee::setPhone(long a){ phone = a;}void Employee::setAfm(char* a){ strcpy(afm, a);}void Employee::setMyCar(Vehicle){ myCar.inputVehicle();}void Employee::inputName(){ cout << "Dwse to onoma : "; cin >> name;}void Employee::inputAddress(){ cout << "Dwse th diefthunsh : "; cin >> address;}void Employee::inputPhone(){ cout << "Dwse to thlefono : "; cin >> phone;}void Employee::inputAfm(){ cout << "Dwse to AFM : "; cin >> afm;}void Employee::inputEmployee(){ cout << "Dwse to onoma : "; cin >> name; cout << "Dwse th diefthunsh : "; cin >> address; cout << "Dwse to thlefono : "; cin >> phone; cout << "Dwse to AFM : "; cin >> afm; myCar = Vehicle();}char* Employee::getName(){ return name;}char* Employee::getAddress(){ return address;}long Employee::getPhone(){ return phone;}char* Employee::getAfm(){ return afm;}Vehicle Employee::getmyCar(){ return myCar;}void Employee::printEmployee(){ cout << "Name:\t" << name << endl << "Address:\t" << address << endl; cout << "Telephone:\t" << charphone(phone) << endl << "AFM:\t" << afm << endl; myCar.printVehicle();}Vehicle::Vehicle(){ strcpy(make,""); strcpy(model,""); strcpy(lp,""); strcpy(color,""); doors = 0; makeyear = 0; hp = 0; cylinders = 0; enginvol = 0;}Vehicle::Vehicle(char* a,char* b,char* c,char* d,int e,int f,int g,int h,int i){ strcpy(make,a); strcpy(model,b); strcpy(lp,c); strcpy(color,d); doors = e; makeyear = f; hp = g; cylinders = h; enginvol = i;}char* Vehicle::getMake(){ return make;}char* Vehicle::getModel(){ return model;}char* Vehicle::getLp(){ return lp;}char* Vehicle::getColor(){ return color;}int Vehicle::getDoors(){ return doors;}int Vehicle::getMakeyear(){ return makeyear;}int Vehicle::getHp(){ return hp;}int Vehicle::getCylinders(){ return cylinders;}int Vehicle::getEnginvol(){ return enginvol;} /*Set methods tou programmatisti*/void Vehicle::setVehicle(char* a,char* b,char* c,char* d,int e,int f,int g,int h,int i){ strcpy(make,a); strcpy(model,b); strcpy(lp,c); strcpy(color,d); doors = e; makeyear = f; hp = g; cylinders = h; enginvol = i;}void Vehicle::setMake(char* a){ strcpy(make,a);}void Vehicle::setModel(char* a){ strcpy(model,a);}void Vehicle::setLp(char* a){ strcpy(lp,a);}void Vehicle::setColor(char* a){ strcpy(color,a);}void Vehicle::setDoors(int a){ doors = a;}void Vehicle::setMakeyear(int a){ makeyear = a;}void Vehicle::setHp(int a){ hp = a;}void Vehicle::setCylinders(int a) { cylinders = a;}void Vehicle::setEnginvol(int a){ enginvol = a;}/*Input methods tou xristi*/void Vehicle::inputVehicle(){ inputMake(); inputModel(); inputLp(); inputColor(); inputDoors(); inputMakeyear(); inputHp(); inputCylinders(); inputEnginvol();}void Vehicle::inputMake(){ cout<<endl<<"Dose tin xora kataskeuis tou autokinitou"<<endl; cin>>make;}void Vehicle::inputModel(){ cout<<endl<<"Dose to modelo tou autokinitou"<<endl; cin>>model;}void Vehicle::inputLp(){ cout<<endl<<"Dose tis pinakides tou autokinitou"<<endl; cin>>lp; while(!checkLp()) { cout<<"Lathos morfi. Dose ksana ton arithmo pinakidas"<<endl; cin>>lp; } }void Vehicle::inputColor(){ cout<<endl<<"Dose to xroma tou autokinitou"<<endl; cin>>color;}void Vehicle::inputDoors(){ cout<<endl<<"Dose poses portes exei"<<endl; cin>>doors; while(doors<2 || doors>7) { cout<<"Ektos orion. Dose ksana ton arithmo"<<endl; cin>>doors; }}void Vehicle::inputMakeyear(){ cout<<endl<<"Dose to etos kataskeuis tou autokinitou"<<endl; cin>>makeyear; while(makeyear<1980 || makeyear>2008) { cout<<"Ektos orion. Dose ksana tin xronia"<<endl; cin>>makeyear; }}void Vehicle::inputHp(){ cout<<endl<<"Dose tous ipous tou autokinitou"<<endl; cin>>hp; while(hp<60 || hp>1000) { cout<<"Ektos orion. Dose ksana tous ipous"<<endl; cin>>hp; }}void Vehicle::inputCylinders() { cout<<endl<<"Dose ta cylindrous tou autokinitou"<<endl; cin>>cylinders; while(cylinders<4 || cylinders>16) { cout<<"Ektos orion. Dose ksana ta kibika"<<endl; cin>>cylinders; }}void Vehicle::inputEnginvol(){ cout<<endl<<"Dose ton kibismo mixanis tou autokinitou"<<endl; cin>>enginvol; while(enginvol<60 || enginvol>6000) { cout<<"Ektos orion. Dose ksana ton volume mixanis"<<endl; cin>>enginvol; }}/*Other*/bool Vehicle::checkLp(){ int i; for(i=0; i<3; i++) { lp[i] -= (lp[i]>90) ? 32 : 0; if(!checkChar(lp[i])) return false; } if(lp[3]<'1' || lp[3]>'9') return false; for(i=4; i<7; i++) { if(lp[i]<'0' || lp[i]>'9') return false; } return true;}bool Vehicle::checkChar(char c){ switch(c) { case 'E': case 'T': case 'Y': case 'I': case 'O': case 'P': case 'A': case 'H': case 'K': case 'Z': case 'X': case 'B': case 'N': case 'M': return true; } return false;}void Vehicle::printVehicle(){ cout<<"Marka: " << make << endl << "Modelo: " << model << endl << "Pinakides: " << lp << endl << "Xroma: " << color << endl << "Portes: " << doors << endl << "Xronia kataskeuis: " << makeyear << endl << "Ipoi: " << hp << endl << "Kilindroi: " << cylinders << endl << "Kibismos: " << enginvol << endl;}int main(){ Vehicle pel1; Employee afa1, afa2; afa1.printEmployee(); afa2.inputEmployee(); afa2.printEmployee(); pel1.setVehicle("Daihatsu","Sirion CX","NZP2473","Silver",4,2004,102,4,1300); pel1.printVehicle(); return 0;}/*i = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16b[i] = + 3 0 - 1 2 3 4 - 5 6 7 - 8 9 0 \0b = "+30-6970-123-456"*/char* charphone(long a){ long c=0; char b[16]; int i; if (a==0) a=1; b[16] = '\0'; for (i=15;i>12;i--){ c = a%10; a /=10; b[i] = itoa(c); } b[12] = '-'; for (i=11;i>8;i--){ c = a%10; a /=10; b[i] = itoa(c); } b[8] = '-'; for (i=7;i>3;i--){ c = a%10; a /=10; b[i] = itoa(c); } b[3] = '-'; b[2] = '0'; b[1] = '3'; b[0] = '+'; return b;}char itoa(long a) { switch (a) { case 1: return '1'; case 2: return '2'; case 3: return '3'; case 4: return '4'; case 5: return '5'; case 6: return '6'; case 7: return '7'; case 8: return '8'; case 9: return '9'; case 0: return '0'; }}