You have been hired to develop a program software for a renting vehicles company called EasyRent. EasyRent will be a vehicle rental software designed to provide customers with simple steps in renting 3 kinds of vehicle: trucks, cars, and buses. The system also offers the customers services for their rental needs such as a navigation system device, car seats, and full insurance.
To start using the software, the staff member first needs to enter all the available vehicle information for the company. After entering all the information, the system will print those details in a database file for the staff record files.
After that, the system will be ready to get reservation requests! With each reservation request, the staff will enter the vehicle information, customer information, pick up and drop off date, and any services the customer would like to add. If the reservation is successful, then an invoice file will be generated. In all cases, the system will record all successful and non-successful reservation requests.
After finish entering all the reservation requests, the system will give the staff a quick overview by showing all reserved vehicles information sorted by pick updates. This will help the staff to prepare the cars for the customers. As a developer, please follow the next three steps which will explain how to develop the EasyRent System.
All vehicles and services which are available for renting will be entered into the system before performing any reservation (see the file inputVehicle.txt).
Command: AddTruck
This command is used to add all information related to the trucks available for renting. The user needs to choose the truck brand name, the model year, truck rating in S.R., transmission type, and truck type. Check the following example and table.
Command Example
AddTruck Toyota 2015 300 true Tractor
Field name | Type | Example |
Brand | String | Toyota |
Year | Int | 2015 |
Rate | double | 300 |
Transmission | boolean | true |
Type | String | Tractor |
Command: AddBus
This command is used to add all information related to the buses available for renting. Similar to the trucks, the user should enter the bus brand, model year, daily rating in S.R., and transmission type. Additionally, it is required to enter the bus capacity (maximum is 30). Check the following example and table.
Command Example
AddBus Mercedes 2015 700 False 30
Field name | Type | Example |
Brand | String | Mercedes |
Year | int | 2015 |
Rate | double | 700 |
Transmission | boolean | False |
Seats | int | 30 |
Command: AddCar
This command is used to add all information related to the cars available for renting. Car fields contain car brand, model year, daily rating in S.R. and transmission type. In addition, it contains two more extra fields: car type which indicates if it is Economy, Sport or Luxury. If the car contains a convertible body style, the data field Convertible will be true, and false means not convertible. Check the following example and table.
Command Example
AddCar Toyota 2015 200 False Economy False
Field name | Type | Example |
Brand | String | Toyota |
year | int | 2015 |
rate | double | 200 |
Transmission | boolean | False |
Type | String | Economy |
Convertible | boolean | False |
Command: AddService
This command will add services for the vehicle rentals need. There are three rental services: Navigation system, Full Insurance and Car Seat. Note that car seat services should be only available for car rentals.
Command Example
AddService Navigation_system 150
Field name | Type | Example |
Service | String | Navigation_system |
Rate | double | 150 |
Command: Quit
The command quit will exit the process of entering the system information.
Important Notes
After reading the file inputVehicle.txt the system should contain all the vehicles types and services which are available for renting. Reservation requests samples can be checked on the file Reservationinput.txt.
Command: Reserve
The command reserve is used to perform vehicle and services reservation. The system should read all tokens until the word submit is found. Note that the process of the reservation and reading information should be different based on the vehicle type. For each reservation, the user should indicate the vehicle type, pickup location, drop off location, pick up and drop off date. It also takes the customer information which are first name, last name, email, credit card number, and the customer code.
Command Example
Reserve Truck Concrete_mixer Manual Jeddah Jeddah 2018 11 19 2018 11 22 Sameer Maghrabi
Sameer@gmail.com 234563 567 Full_Insurance submit
Field name | Type | Example |
Vehicle Type | String | Truck |
Truck Type | String | Concrete_mixer |
Transmission | String | Manual |
Pickup location | String | Jeddah |
Drop off location | String | Jeddah |
Pick up date | Date | 2018 11 19 |
Drop off date | Date | 2018 11 22 |
First name | String | Sameer |
Last name | String | Maghrabi |
String | Sameer@gmail.com | |
Credit Card | long | 234563 |
Customer Code | int | 567 |
Service | String | Full_Insurance |
Be aware of the following notes.
Important Notes
The Customer code determines the discount rate:
The system will read the Transmission as a string, it is even "Manual" or Automatic, then the system should translate it into Boolean: True means Manual, False means Automatic.
The system should search for the requested vehicle and check its date availability. It is mandatory to use the class Date method to perform this step.
For each new reservation, the system should generates a new reservation reference code: Renter initial letters + Random value (between 0 and 999) + the year of the vehicle. Example: AM_145_2015
This code will be printed later in the ReservationStatus.txt and the invoice(check step 3).
To reserve a bus, number of passengers should be equal or less than the number of seats for that particular bus. Also, car seats service is only available for car rentals
Error message should be printed if the user tried to reserve a vehicle which is not on the system or this particular vehicle is already reserved on the selected dates (see the ReservationStatus.txt), for example:
Command Truck Reservation: CONFLICT
Sorry! There is no available Truck
1. Print the input command status in the file ReservationStatus.txt.
The system should print the status for commands explained in all the previous two steps in the file ReservationStatus.txt. It will print confirmation messages for all successful and non- successful inputs. For example, once the system processes the following command from the Reservationinput.txt:
Command Example
Reserve Truck Concrete_mixer Manual Jeddah Jeddah 2018 11 19 2018 11 22 Sameer Maghrabi
Sameer@gmail.com 234563 567 Full_Insurance submit
It will display the following in the ReservationStatus.txt
Printed Example
*****Reservation Refrence number : SM_721_2017
******Customer information : Customer Name: Sameer Maghrabi, Email: Sameer@gmail.com, Code: 567
******Pick up location : Jeddah ******Drop of location : Jeddah
******Pick up date : 19-‐11-‐2018 ******Drop of date : 22-‐11-‐2018
******Vehicle information : The Truck has a Type: Toyota, Year: 2017, Transmission: Manual The truck
Type is: Concrete_mixer
******Additional services : [Service Full_Insurance]
Command: Print_The_Soreted_Reservations'_File_By_PickUp
This command will sort and print ONLY the successful Reservation list according to the pick up date. Sorting the date should be implemented in the method "copmareTo()", it is mandatory to use compareTo() method from the date class. It then prints the sorted information on the Database.txt as the following example:
Printed Example
-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐Display all customer codes and names for all successful reservations-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐
Pick Up date : 19-‐11-‐2018 Customer Name: Sameer Maghrabi Code: 567
Pick Up date : 19-‐11-‐2018 Customer Name: Saleem Omar Code: 786
Pick Up date : 25-‐11-‐2018 Customer Name: Sara Shalabi Code: 101
Pick Up date : 1-‐1-‐2019 Customer Name: Arwa Shalabi Code: 236
Pick Up date : 12-‐3-‐2019 Customer Name: Aziz Mohammed Code: 222
Command: Quit
After the command Quit in the reservation input file, the system will generate two main outputs:
a) Database file: The system will prints all the vehicle information in the file Database.txt and sorted based on the model year.
b) Invoice files: Invoice files are generated for each successful reservation (check the files 101.txt,, 786.txt). The name of each file represents the customer's code of that particular reservation. The system should calculate the final price using the method CalculateFinalPrice() and print the invoices in separated invoice files. The final cost is computed by considering the following:
1. The vehicle rating cost
2. The requested services cost
3. The calculated discount based on the customer code
Important Notes
Calculating the final cost will be different from one type of vehicle to another only in the following cases:
You should create seven classes, and two interfaces as shown on the UML diagram. Attributes, methods and constructors in the UML are all suggested, you can change them based on your algorithm.
To link the classes, you should create 3 Arraylists:
Before performing any reservation, you should determine if the vehicle is available on that particular day. This process is implemented by comparing the pick up and the drop of dates for that vehicle type using the method Conflict(). Remember it is mandatory to use the Date class methods to compare dates.
Figure 1 Diagram illustrates the inheritance and aggregation relationships between the classes, zoom for the details: see image.