Faculty of Engineering and Technology Electrical and Computer Engineering Department
Faculty of Engineering and Technology Electrical and Computer Engineering Department
Submission
- Five python scripts (one module for each task and the main script).
- A report including screenshots of the output of your code with proper documentation.
- Name the pdf file as xxxxxxx-yyyyyyy-Sec-zz.pdf
xxxxxxx : university number
yyyyyyy : Your first Name
zz: Section Number
Problem Description
A car rental company records all car rentals manually on a text file (“CarRentalOld.txt”). They need
to record the following information about each car rental:
- Name: Name of the person renting the car (example: Ahmad Omar),
- Id: Id number of the person renting the car (example: 802424333),
- DoB: Date of birth of the person renting the car (example: 10 April 2000),
- Mobile: mobile number of the person renting the car (example: 0550123456),
- CL: an alphanumeric value representing the car license number (example: A10B20)
- CM: car make (example: Audi),
- Year: the year of manufacturing the car (example: 2018),
- SD: car rent start date (example: 15 April 2020),
- ED: car rent end date (example: 17 April 2020),
- RB: the amount the customer paid for this rental (example; 170).
This information is added in separate lines for each car rental with a semicolon as the separator
between fields. Here are a few examples:
Ahmad Omar;802424333;10 April 2000;0550123456;A10B20;Audi;2018;15 April 2020;17 April 2020;350
The owner of the company finds out that the employees were not accurate in entering this
information into the text file. He finds out the following mistakes:
1- Dates are input in a different format. He finds out the following two formats dd-mm-yyyy
and dd/mm/yyyy. See the following examples:
a. Ahmad Omar;802424333;10-04-2000;0550123456;A10B20;Audi;2018;15-04-2020;17-04-2020;350
b. Abeer Islam;801321533;01/03/1999;0440123456;C30B20;BMW;2016;05/02/2019;08/02/2019;370
Page 1 of 2
2- Some fields are missing in the database. See the following examples:
a. Ahmad Omar;;10 April 2000;0550123456;A10B20;Audi;2018;15 April 2020;17 April 2020;350
b. ;801321533;1 March 1999;0440123456;C30B20;;2016;5 February 2019;8 February 2019;370
Another example:
a. Ahmad Omar;802424333;10-4-2000;0550123456;A10B20;Audi;2018;15 April 2020;17 April 2020;350
b. Ahmad Omar;802424333;10/4/2000;0550123456;A10B20;Audi;2018;15 April 2020;17 April 2020;350
c. Ahmad Omar;802424333;;0550123456;A10B20;Audi;2018;15 April 2020;17 April 2020;350
Tasks:
Write separate python modules for each of the following tasks. Then import and call the modules in
the main python script to perform tasks and print output on screen.
Task #1: Write a python module to fix the old database. Write a separate function for each of the
following:
1- Modify the format of the dates in the database (example: 10-4-2000 à 10 April 2000)
2- Try to complete the missing information in the database. Then move all not complete entries
to a new text file called (“CarRentalMissing.txt”) and the completed entries to a text file
called (“CarRentalCompleted.txt”)
3- Remove duplicate entries form the completed database.
Task #2: Write a python module with proper functions to inquire and print on-screen information
from the completed database. The inquiry must be of two types:
1- Inquiry about a person using the Name or Id. Print information about the person and all cars
rented by the person. In this case, print also the amount paid by this person for renting
cars.
2- Inquiry about a car using the CL. Print information about the car and all persons rented
the car. In this case, print also the revenue made by renting this car.
Task #3: Write a python module to add information for new car rental to the completed database.
This should be based on the following:
1- Input the rental dates provided by the customer.
2- Print on screen the cars available during these dates.
3- Add a car and rental information to the completed database.
Task #4: Write a python module with proper functions to print on-screen statistics about each car in
the completed database. For each car print the following:
1- Number of days the car was rented,
2- Revenue made by renting the car,
3- Average price per day for renting each car.
Page 2 of 2