Create a car rental system where customers rent cars for a given period of time. You are given the following classes: Car– a class that has the following properties: car type: Mrcedes, Opel, Fiat, ....etc.. car license end date. car number. Necessary constructor and getters/setters. Small car class– inherits from the car and has the following constants: 4 passengers, Motor 1200, air-conditioner. Medium car class– inherits from the car and has the following constants: 4 passengers, Motor 1400, air-conditioner, Speed Control. Large car class- inherits from car and has the following constants: 6 passengers, Motor 1600, air-conditioner, speed control, Wi-Fi. Customer class: holds first name, last name and id number as member variables (of course with necessary constructor, getters and setters) . Rent class (representing the time period when the car is rent): holds startDate and endDate, rent price (of course with necessary constructor, getters and setters). In addition to the previous classes, Implement the following interface: rentInterface – holds a method displayRent(). The Rent Class implements this interface. Override the__toString() method for each class (of all previous classes) to print information about the object from the class in which it is instantiated. For example, suppose you have an object called someCar instantiated from small car class with values: "Opel", "20/9/2021", 12548754 (these values inherited from the car class), and the other contact values in the small car class. The toString() method in this case prints (for example): "The car type is Opel, the license end date is:20/9/2021 and the car number is:12548754. This car has 4 passengers size, Motor power of 1200 hp and equipped with an air-conditioner". This statement will be returned from the method toString(). Write a class rentingManager with a static method rentCar($car, $rent) that handles car renting and prints a message whether the operation was successful or not. This method takes two objects (car and rent) and adds them to an array of rents. This array contains the rents for each car. Of course, there must be no conflict in the dates of rents. Now, after writing the code of the previous classes and interface, create an array of different cars. Perform the following operations: Create an array of cars, in which the array contains different objects of the three types of cars (create the objects of the array and fill the objects with suitable data). Display the array by small cars and medium ones with a rent price less than or equal to 250.00 Display the array by all cars with an air conditioner. Return the car numbers of all cars which have a wi-fi service.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a car rental system where customers rent cars for a given period of time.

You are given the following classes:

  • Car– a class that has the following properties:

    • car type: Mrcedes, Opel, Fiat, ....etc..

    • car license end date.

    • car number.

    • Necessary constructor and getters/setters.

  • Small car class– inherits from the car and has the following constants: 4 passengers, Motor 1200, air-conditioner.

  • Medium car class– inherits from the car and has the following constants: 4 passengers, Motor 1400, air-conditioner, Speed Control.

  • Large car class- inherits from car and has the following constants: 6 passengers, Motor 1600, air-conditioner, speed control, Wi-Fi.

  • Customer class: holds first name, last name and id number as member variables (of course with necessary constructor, getters and setters) .

  • Rent class (representing the time period when the car is rent): holds startDate and endDate, rent price (of course with necessary constructor, getters and setters).

In addition to the previous classes, Implement the following interface:

  • rentInterface – holds a method displayRent(). The Rent Class implements this interface.

  • Override the__toString() method for each class (of all previous classes) to print information about the object from the class in which it is instantiated. For example, suppose you have an object called someCar instantiated from small car class with values: "Opel", "20/9/2021", 12548754 (these values inherited from the car class), and the other contact values in the small car class. The toString() method in this case prints (for example): "The car type is Opel, the license end date is:20/9/2021 and the car number is:12548754. This car has 4 passengers size, Motor power of 1200 hp and equipped with an air-conditioner". This statement will be returned from the method toString().

  • Write a class rentingManager with a static method rentCar($car, $rent) that handles car renting and prints a message whether the operation was successful or not. This method takes two objects (car and rent) and adds them to an array of rents. This array contains the rents for each car. Of course, there must be no conflict in the dates of rents.

Now, after writing the code of the previous classes and interface, create an array of different cars. Perform the following operations:

  • Create an array of cars, in which the array contains different objects of the three types of cars (create the objects of the array and fill the objects with suitable data).

  • Display the array by small cars and medium ones with a rent price less than or equal to 250.00

  • Display the array by all cars with an air conditioner.

  • Return the car numbers of all cars which have a wi-fi service.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education