Question: write using basic c++ functions, full solution class Rental_Car{ private: string model; string number; int rental_days; public: Rental_Car(); Rental_Car(string model, string number, int rental_days); void

write using basic c++ functions, full solution

write using basic c++ functions, full solution class Rental_Car\{ private: string model;

string number; int rental_days; public: Rental_Car(); Rental_Car(string model, string number, int rental_days);void set_number(string number); void set_model(string model); void set_rental_days(int days); string get_model(0; string

class Rental_Car\{ private: string model; string number; int rental_days; public: Rental_Car(); Rental_Car(string model, string number, int rental_days); void set_number(string number); void set_model(string model); void set_rental_days(int days); string get_model(0; string get_number(); int get_rental_days(); virtual double calculate_cost ()=0; /lcost of renting the car for rental_days void printData(); //print all object attributes \}; Question 4: [7 points] Create the derived class Driver_Rental_Car such that: 1) it publicly inherits class Rental_Car [1 point] 2) it has a private data member driver_name (string), and the protected data members daily_cost (float) and fees (float) [1 point] 1) write a parametrized constructor - with parameters for all data members in the base class and the derived class [0.5 point] - the constructor should have default arguments for the daily_cost equal to 35 , and for fees equal to 29 [0.5 point] - the constructor should initialize all attributes properly using this pointer explicitly [1 point] 3) write the member function calculate_cost() which should compute and return the cost of renting a car such that the cost would equal: rental_days * daily_cost + fees [1 point] 4) implement the function printData() to print all the attributes of an object of type Driver_Rental_Car [2 point] 1) Given the prototype of the global function void increaseFees(Driver_Rental_Car \& r, int val); How can we make this function a friend of the class Driver_Rental_Car [1 point] 2) Implement the friend function increaseFees from item (1) of this question such that it adds the amount val to the current value of the attribute fees. [1 point] 3) Overload the operator > as a const member function in class Driver_Rental_Car. - The function receives a constant object of type Driver_Rental_Car by reference. The function returns true if the renting cost of the calling object is greater than the renting cost of object passed as an argument. It should return false otherwise. [ 3 point] 1) create a const Driver_Rental_Car object with any prober values and name it drc 2) declare a pointer of type Rental_Car and call it rcptr 3) create a Driver_Rental_Car object dynamically with any prober values and make the pointer reptr points to it. 4) call printData using rcptr, would this call the function in Rental_Car class or in Driver_Rental_Car class. 5) call calculate_cost using rcptr, would this call the function in Rental_Car class or in Driver_Rental_Car class? 6) call the overloaded operator function to test if the object pointed to by rcptr has a greater rental cost than the object drc or not. 7) free the memory pointed to by the pointer rcptr 8) if we have the class Company_Rental_Car, which inherits class Rental_Car, can we use the pointer roptr to point to the object crc of type Company_Rental_Car after implementing (7)? Briefly explain your answer. 9) Can we pass the object crc from (8) as an argument to the function operator> of class Driver_Rental_Car? Briefly explain your answer. 10) is the following declaration correct in the main function? explain your answer. Rental_Car rentalCar1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!