This assignment involves a Car Rental System. The program has been implemented in C++ programming language and file handling has been used for storing the data of the program. There are 3 csv files namely car.csv, customer.csv and employee.csv that stores the records of cars, customers and employees respectively.
Initially, the csv files contains 5 cars, 5 customers (Eg: userID c0 has password 123) and 5 employees (Eg: userID e0 has password 123). The program initially begins with one manager with ID: m0, Name: manager, Password: 123. Other managers can be added in runtime but since they are not stored in a database or file, record of managers initiates with the above whenever the program is restarted.
This is an Object Oriented Program that has a car class, a user class, a manager and a customer class. The manager an customer class are derived from the user class. Due to similar operations of employees and customers, they have been implemented using the same customer class. ID, name and password of a users and ID and name of cars are set as protected and private variables respectively.
The code for the software has been written in two cpp files namely:
- classes.cpp : contains the definition of the classes and the functions associated with the classes
- car_management.cpp : contains the various functions of the program and the main function. To run the program, we have to run the car_management.cpp file.
- Car class: ID, Name, Model, Color, Condition, Is_booked, Due_date, Damage, Renter_ID, Renter_name
- User class: ID, Name, Password
- Customer class (derived from user class): ID, Name, Password, Fine, Record, Discount (0% for customer and 15% for employee), Number_of_rented_cars
- Manager class (derived from user class): ID, Name, Password
Data is stored in the csv files in the same order as given above.
The record of the customer/employee is an integer between 0 to 5. A person's record decreases by 1 when he returns a car after the due date or caused some damage to the car. It also denotes the maximum number of cars that can be rented by a customer/employee. A new customer's or employee's record is set to the average record of customers or employees respectively.
- Show all cars
- Show all customers
- Show all employees
- Show all managers
- Add a car
- Remove a car
- Update a car
- Add a customer
- Remove a customer
- Update a customer
- Add an employee
- Remove an employee
- Update an employee
- Add a manager
- Remove a manager
- Update a manager
- Search for a customer - Search by ID, Name
- Search for an employee - Search by ID, Name
- Search for a manager - Search by ID, Name
- Search for a car - Search by ID, Name, Model, Color, Condition, Renter_ID
- Show rented cars
- Logout
- Show available cars
- Show rented cars
- Rent a car - asks for the number of days you want to rent the car for and updates the parameters accordingly in csv files. Calculates the fare (₹1000 per day) of these days and displays it.
- Return a car - checks the due date and asks for any damage in the car
- Show fine
- Clear fine
- View profile
- Logout
Since employee and customer have been implemented by the same class, both have the same functionalities
- Login: gives 3 login options namely - login as customer, login as employee and login as manager
- Signup: gives 2 signup options namely - signup as customer and signup as employee
- Exit: Exits the program
While signing up, one has to give his name and password and the system generates a unique userID and displays it. While logging in, one has to give his UserID (Eg: c0 or e0 or m0) and password that is verified and the action proceeds. After signing up, the employee or customer is given a unique ID. The maneger, customer or employee can access the functions of the program once he/she has logged in.
The fine system gives a fine to user if there is a damage in the car (₹200 per damage) or if the user return the car after the due date (₹1200 per late day). For testing the late return fine feature, we can manually change the due date of a car (in format dd-mm-yyyy) in 'car.csv' after booking the car for a user and then try returning the car from that user. The fine will be added to the fine of the user.