1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#include <iostream>
#include <locale>
using namespace std;
class Polygon {
protected:
float moneyperhour, hours;
public:
void set_values(float a, float b){
hours=a; moneyperhour=b;
}
};
class Driver: public Polygon {
private:
string number = "äåñÿòü";
public:
float salary(){return ((hours*moneyperhour)*20)/100;}
string GetNumber(){
return number;
}
};
class TouristicCoach: public Polygon {
public:
float cost () {return (hours*moneyperhour);}
void seat()
{
passenger.seat();
}
void Info(){
cout<<"\n"<<" àâòîï³äïðèºìñò³ º "<<driver.GetNumber()<<" âî䳿â"<<endl;
}
private:
class Passenger{
private:
int seats[4]={19,38,56,82};
public:
void seat(){
cout<<"Ìàêñèìàëüíà ê³ëüê³ñòü ïàñàæèð³â ì³êðîàâòîáóñà "<<seats[0]<<"."<<endl;
cout<<"Ìàêñèìàëüíà ê³ëüê³ñòü ïàñàæèð³â íåâåëèêîãî àâòîáóñà "<<seats[1]<<"."<<endl;
cout<<"Ìàêñèìàëüíà ê³ëüê³ñòü ïàñàæèð³â ñåðåäíüîãî àâòîáóñà "<<seats[2]<<"."<<endl;
cout<<"Ìàêñèìàëüíà ê³ëüê³ñòü ïàñàæèð³â âåëèêîãî àâòîáóñà "<<seats[3]<<"."<<endl;
}
};
Passenger passenger;
static Driver driver;
};
int main () {
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
TouristicCoach passengers;
passengers.seat();
TouristicCoach drivers;
drivers.Info();
cout<<"\n"<<"Ââåä³òü ïîòð³áíó ê³ëüê³ñòü ãîäèí."<<endl;
float hour;
cin>>hour;
TouristicCoach minibus;
minibus.set_values(hour,200);
cout<<"Çà îðåíäó ì³êðîàâòîáóñà íà "<<hour<<" ãîäèí ïîòð³áíî ñïëàòèòè "<< minibus.cost()<<" ãðèâåíü." << endl;
TouristicCoach small;
small.set_values(hour,400);
cout<<"Çà îðåíäó íåâåëèêîãî àâòîáóñà íà "<<hour<<" ãîäèí ïîòð³áíî ñïëàòèòè "<< small.cost()<<" ãðèâåíü." << endl;
TouristicCoach medium;
medium.set_values(hour,600);
cout<<"Çà îðåíäó ñåðåäíüîãî àâòîáóñà íà "<<hour<<" ãîäèí ïîòð³áíî ñïëàòèòè "<<medium.cost()<<" ãðèâåíü."<< endl;
TouristicCoach big;
big.set_values(hour,800);
cout<<"Çà îðåíäó âåëèêîãî àâòîáóñà íà "<<hour<<" ãîäèí ïîòð³áíî ñïëàòèòè "<<big.cost()<<" ãðèâåíü." << endl;
Driver minidriver;
minidriver.set_values(hour,200);
Driver smalldriver;
smalldriver.set_values(hour,400);
Driver medidriver;
medidriver.set_values(hour,600);
Driver bigdriver;
bigdriver.set_values(hour,800);
cout<<"\n"<<"Çà ïåðåâåçåííÿ ì³êðîàâòîáóñîì âîä³é îòðèìຠ"<<minidriver.salary()<<" ãðèâåíü."<<endl;
cout<<"Çà ïåðåâåçåííÿ íåâåëèêì àâòîáóñîì âîä³é îòðèìຠ"<<smalldriver.salary()<<" ãðèâåíü."<<endl;
cout<<"Çà ïåðåâåçåííÿ ñåðåäí³ì àâòîáóñîì âîä³é îòðèìຠ"<<medidriver.salary()<<" ãðèâåíü."<<endl;
cout<<"Çà ïåðåâåçåííÿ âåëèêèì àâòîáóñîì âîä³é îòðèìຠ"<<bigdriver.salary()<<" ãðèâåíü."<<endl;
return 0;
}
|