Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

IE5600 Applied Programming for Industrial Systems

AY 2022/23 Semester 1

Individual Assignment 1 - PyCar

Objectives

At the completion of the individual assignment, you should:

1.   Develop a better understanding of how to apply the computational problem solving process to a moderately complex problem.

2.   Implement imperative and structured programming paradigms in Python.

3.   Apply appropriate control flow statements to implement algorithm.

4.   Apply appropriate multi-dimensional data structures to implement algorithm.

General Requirements

You are required to develop a Python program known as PyCar to manage the business operations  of a  car  rental  company  with  three  outlets.  Some  of the  essential  business operations include fleet management, rental reservations and rental operations (i.e., pickup and return of rental cars).

The company currently operates the following three outlets that is opened daily but only during the respective operating hours:

•   Outlet A – 9 am to 6 pm

•    Outlet B – 9 am to 6 pm

•   Outlet C – 8 am to 8 pm

Each car in the company’s fleet is associated with a particular make and model, e.g., Toyota Corolla, and categorised into one of three categories Sedan,  SUV and MPV. A car is available for rental during a particular period if it is not allocated to an existing reservation or not under maintenance. Rental fees are typically quoted on a daily basis for a contiguous rental period of 24 hours. That is, if the rental duration is 24 hours or any part thereof, the customer will be charged for one day of rental. The daily rental rate for each category of cars is fixed as follows:

•    Sedan – $100/day

•    SUV – $150/day

•   MPV – $200/day

When renting a car, customers can only specify the required car category, pickup date/time, return date/time, pickup outlet and return outlet. In other words, customers can be allocated any car of any make and model as long as the car is of the correct category. For the location options, customers can specify the return outlet to be the same as the pickup outlet or a different outlet, subject to the operating hours of the respective outlet.

In order to maximise business opportunities, the company allows a customer to reserve a car that is last returned to a different outlet as long as the car can be moved to the required pickup outlet in time. To facilitate a timely pickup, a minimum transit time of 2 hours is enforced. The company will assign an employee to drive the car from the last returned outlet to the new pickup outlet. For example, it should be possible for a customer to rent a car for pickup at Outlet A on 3 October  12 pm that is last returned to outlet B on 3 October  10 am. The company will assign an employee to drive the car from Outlet B to Outlet A at an appropriate time between  10 am and  12 noon taking into consideration the travel duration and pickup time.

PyCar is also responsible for the actual allocation of cars to fulfil the rental reservations at each outlet on a daily basis. When performing car allocation, it is important to take into consideration the car category of each reservation and the pickup location. As part of the car allocation process, PyCar  also needs to  generate the required transit records  so that the company can assign its employees to move cars from one outlet to another.

Use Cases

Implement the  following use  cases  for PyCar without the use of any predefined Python modules other than those specified below:

datetime

Your program should NOT contain any other import statement unless you are importing your own user-defined module(s).

S/N

Use Case

Use Case Description/Business Rules

1

Load Initial Data

(1 mark)

Auto load the initial data given in Appendix A

You required to use an appropriate data structure to represent the initial data in-memory.

It is not necessary to save the data to a file.

2

Add Car

(2 mark)

Add a new car.

If the license plate number already exists, print out an error message.

Perform input data validation on category, status and outlet. Output an appropriate error message whenever necessary.

Sample Input:

Input license plate number

Input make

Input model

S/N

Use Case

Use Case Description/Business Rules

Input category Sedan, SUV, MPV

Input status Available, Allocated, Pickup, Maintenance

Input outlet Outlet A, Outlet B, Outlet C

3

Reserve Car

(3 mark)

Prompt user to input customer name and the required options.

Perform a check to determine whether the existing fleet of cars is able to cater to the required reservation.

The reservation check should take into consideration:

o Only cars that are not under maintenance are rentable.

o Current, i.e., last return, outlet of a car.

o Existing reservations in PyCar.

o Cars are only allocated on the day of pickup.

o The operating hours of the pickup outlet and return outlet.

Output the availability of the required car category.

If the required car category is available:

o Calculate and output the rental fee.

o Prompt user to confirm the reservation.

If user confirms the reservation, save the reservation data into an appropriate data structure in-memory and output a suitable numerical reservation number.

Sample Input:

Input customer name

Input car category

Input pickup date/time

Input return date/time

Input pickup outlet

Input return outlet

Sample Output:

Output availability Yes/No

Output rental fees if available

Confirm reservation Yes/No

Sample Use Cases based on Initial Data:

Alice, Sedan, 03/10/22 08:00, 05/10/22 06:00, Outlet   A, Outlet A Not Available (Outside Outlet Operating Hours)

Bob, Sedan, 03/10/22 09:00, 05/10/22 9:00, Outlet A, Outlet A Available, $200 and Reserved with #1

Charles, SUV, 03/10/22 09:00, 05/10/22 16:00, Outlet C, Outlet C Available, $450 and Reserved with #2

Deborah, SUV, 04/10/22 09:00, 05/10/22 09:00, Outlet C, Outlet C Not Available