Question
i need to complete only the (sub main) of this C++ code please i will add a part of the run example it is really
i need to complete only the (sub main) of this C++ code please i will add a part of the run example it is really too longe i can not uplod it all....
Define an object of class Agency and program a small menue inside a loop with in the example shown functionalities A to K for this object as given below. Define your classes and the functionalities of the menue entries step by step. Start for example with class DayOfYear, define two variables today and tomorrow and program first functionalities B, D and E (only output), then maybe G, H and I with the related classes, following e.g. C and F, and so on.
Implement in L a simulation of reservations using random numbers for the vehicle number, the day/date of renting inbetween day 1 and 365, the number of rental days inbetween 1 and 7 and a string "customer" with a sequential number generated. A small example file to generate random numbers can be downloaded in the course.
#include
public:
Vehicle() {
}
int get_no() { return this->no; }
string get_model() { return this->model; }
float get_price(int rentalDays) { return this->price24h*rentalDays; } virtual void print()=0; };
class Bike: public Vehicle { public:
Bike(int no, string model) { this->no = no; this->model = model; this->price24h = price24h; } virtual
void print() { cout<<"(BIKE) no : "< class EMotorVehicle: public Vehicle { public: EMotorVehicle(int no,string model,float price24h) { this->no = no; this->model = model; this->price24h = 9.99; } EMotorVehicle() { } virtual bool is_streetLegal()=0; void print() { if(!this->is_streetLegal()) cout<<"(not street legal)"< class EBike: public EMotorVehicle { public: EBike(int no,string model,float price24h = 29.99) { this->no = no; this->model = model; this->price24h = price24h; } bool is_streetLegal() { return true; } void print() { cout<<"(EBkie) "; EMotorVehicle::print(); } }; class EScooter: public EMotorVehicle { private: bool streetLegal; public: EScooter(int no,string model,float price24h = 19.99,bool streeLegal=false) { this->no = no; this->model = model; this->price24h = price24h; this->streetLegal = streetLegal; } bool is_streetLegal() { return this->streetLegal; } void print() { cout<<"EScooter) "; EMotorVehicle::print(); } }; class DayOfYear { private: unsigned short dayOfYear; unsigned short year; const unsigned static short days[]; //12 months + 0 for the 1st January public: DayOfYear(short dayOfYear =1,short year=365) { this->dayOfYear = dayOfYear; this->year = year; } DayOfYear(int day, int month, int year) { this->dayOfYear = getDayOfYear(day,month); this->year = year; } short getDayOfYear(int day, int month) { short dayOfYear=0 ; for(int i=0;i short get_dayOfYear() { return this->dayOfYear; } DayOfYear operator++() { short newYear; short newDayOfYear; if(this->dayOfYear%365 == 0) { newYear = this->year+1; newDayOfYear = 1; } newDayOfYear = this->dayOfYear + 1; return DayOfYear(newDayOfYear,newYear); } string getDayAndMonth() { int prevDay; int day = this->dayOfYear; int month=-1; while(day >0) { month++; prevDay = day; day -= days[month]; } return string(prevDay+"/"+month); } ostream& operator<<(ostream& os) { os < class Rental { private: static const int no = 478; DayOfYear from; // starting day of rental int days; // no. rental days string customer; //renting person name public: Rental() { } int get_days() { return this->days; } DayOfYear get_from() { return this->from; } DayOfYear get_until() { DayOfYear until(this->from); // Creating a new Object of DayOfYear int rentalDays = this->days; while(rentalDays--) { until = ++until; } return until; } void print() { cout< ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-01 E print rental of tomorrow 2021-01-02 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: b input date of today: 2021-01-08 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: d SCHEDULE FOR 2021-01-08 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: e SCHEDULE FOR 2021-01-09 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: f profit: 0.00 EUR ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: g agency profit: 0.00 EUR ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: h agency profit percent: 35 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: i how many Bikes in this simulation? 3 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: f SCHEDULE FOR 1: City1 (Bike) SCHEDULE FOR 2: City2 (Bike) SCHEDULE FOR 3: City3 (Bike) profit: 0.00 EUR ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: j how many EBikes in this simulation? 4 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: f SCHEDULE FOR 1: City1 (Bike) SCHEDULE FOR 2: City2 (Bike) SCHEDULE FOR 3: City3 (Bike) SCHEDULE FOR 4: Trekky1 (EBike) SCHEDULE FOR 5: Trekky2 (EBike) SCHEDULE FOR 6: Trekky3 (EBike) SCHEDULE FOR 7: Trekky4 (EBike) profit: 0.00 EUR ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: i how many Bikes in this simulation? 1 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: f SCHEDULE FOR 1: City1 (Bike) SCHEDULE FOR 2: City2 (Bike) SCHEDULE FOR 3: City3 (Bike) SCHEDULE FOR 4: Trekky1 (EBike) SCHEDULE FOR 5: Trekky2 (EBike) SCHEDULE FOR 6: Trekky3 (EBike) SCHEDULE FOR 7: Trekky4 (EBike) SCHEDULE FOR 8: City4 (Bike) profit: 0.00 EUR ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: k how many EScooters in this simulation? 3 ______________ MENUE A end of simulation B set new simulation date C new rental manually D print rental of today 2021-01-08 E print rental of tomorrow 2021-01-09 F print all rentals G print agency profit H set agency profit percent I add bikes J add E-bikes K add E-scooters L new rental simulation your choice: f SCHEDULE FOR 1: City1 (Bike) SCHEDULE FOR 2: City2 (Bike) SCHEDULE FOR 3: City3 (Bike) SCHEDULE FOR 4: Trekky1 (EBike) SCHEDULE FOR 5: Trekky2 (EBike) SCHEDULE FOR 6: Trekky3 (EBike) SCHEDULE FOR 7: Trekky4 (EBike) SCHEDULE FOR 8: City4 (Bike) SCHEDULE FOR 9: Scooty1 (not street legal) (EScooter) SCHEDULE FOR 10: Scooty2 (not street legal) (EScooter) SCHEDULE FOR 11: Scooty3 (not street legal) (EScooter) profit: 0.00 EUR
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started