🛑 Disclaimer: Read the following conditions carefully:
For whom this assignment is for:
1. This assignment is a substitute for final term quiz 2
2. Any student who submits this assignment, their quiz 2 marks won't be counted.
3. Therefore it is recommended for those who missed the quiz to attempt this assignment.
4. If you have already taken quiz 2, then submitting this assignment means that only this
assignment's mark will be counted and quiz's mark won't be counted.
Rules of academic honesty:
1. You are not allowed to include any AI generated content into your submission.
2. You are not allowed to include other's work or part of other people's work as your own.
3. Any sign of violation of the rules will mark your assignment 0/30.
Submission guidelines:
1. The deadline is 5th June 11:59pm. Assignment will automatically close and no late submission
will be allowed.
2. You will attach only a .cpp file as your submission which will contain the code
3. Filename of your .cpp file will be student-id_student-name_[IP-section].cpp
Example: 25-23523-1_Rahim-Mia_[B4].cpp
Go to next page
📘 Assignment Title: Vehicle Rental System Using OOP Concepts in C++
📖 Scenario:
A vehicle rental company manages a fleet of various types of vehicles including Cars, Motorcycles,
and Trucks. Each vehicle type has different rental pricing policies and features. The company wants to
automate the process of renting and returning vehicles, calculating rental costs, and maintaining a
list of available vehicles.
🧩 Functional Requirements (General Instructions):
1. Design a class hierarchy representing the vehicles. All types of vehicles should share common
properties and behaviors.
Create a base class called Vehicle that contains attributes and functionalities common to all
types of vehicles.
2. Create specific types of vehicles with additional properties and specialized rental cost calculation
logic.
Create derived classes called Car , Motorcycle and Truck .
3. Implement a menu-driven interface to allow the user to:
Add a new vehicle (of any supported type)
Display all available vehicles
Rent a vehicle (by registration number), and calculate rental cost
Return a rented vehicle to make it available again
Exit the system
🖥️Sample Menu Interface (User View)
===== Vehicle Rental System =====
===== Create by: <Student Name> | <Student ID> =====
1. Add Vehicle
2. Display All Available Vehicles
3. Rent a Vehicle
4. Return a Vehicle
5. Exit
Enter your choice:
🧪 Sample Input/Output Trace
✅ Test Case 1: Add Vehicles
Enter your choice: 1
Select vehicle type:
1. Car
2. Motorcycle
3. Truck
Enter type: 1
Enter registration number: ABC123
Enter brand: Toyota
Does it have air conditioning (1 for Yes, 0 for No): 1
Vehicle added successfully.
Enter your choice: 1
Select vehicle type:
1. Car
2. Motorcycle
3. Truck
Enter type: 1
Enter registration number: XYZ789
Enter brand: Honda
Does it have air conditioning (1 for Yes, 0 for No): 0
Vehicle added successfully.
Enter your choice: 1
Select vehicle type:
1. Car
2. Motorcycle
3. Truck
Enter type: 2
Enter registration number: MOTO456
Enter brand: Yamaha
Does it have a helmet (1 for Yes, 0 for No): 1
Vehicle added successfully.
Enter your choice: 1
Select vehicle type:
1. Car
2. Motorcycle
3. Truck
Enter type: 3
Enter registration number: TRK001
Enter brand: Volvo
Enter load capacity in tons: 7
Vehicle added successfully.
✅ Test Case 2: Display Available Vehicles
Enter your choice: 2
--- Available Vehicles ---
[Car] Reg#: ABC123 | Brand: Toyota | AC: Yes | Available: Yes
[Car] Reg#: XYZ789 | Brand: Honda | AC: No | Available: Yes
[Motorcycle] Reg#: MOTO456 | Brand: Yamaha | Helmet: Yes | Available: Yes
[Truck] Reg#: TRK001 | Brand: Volvo | Capacity: 7 tons | Available: Yes
✅ Test Case 3: Rent a Vehicle
Enter your choice: 3
Enter registration number to rent: ABC123
Enter number of rental days: 3
--- Rental Summary ---
Vehicle: Toyota (ABC123)
Rental Cost for 3 days: $180
Vehicle has been rented.
✅ Test Case 4: Try Renting Same Vehicle Again
Enter your choice: 3
Enter registration number to rent: ABC123
Vehicle is currently unavailable for rental.
✅ Test Case 5: Rent Another Type of Vehicle
Enter your choice: 3
Enter registration number to rent: TRK001
Enter number of rental days: 2
--- Rental Summary ---
Vehicle: Volvo (TRK001)
Rental Cost for 2 days: $200
Vehicle has been rented.
✅ Test Case 6: Display Available Vehicles After Rentals
Enter your choice: 2
--- Available Vehicles ---
[Car] Reg#: XYZ789 | Brand: Honda | AC: No | Available: Yes
[Motorcycle] Reg#: MOTO456 | Brand: Yamaha | Helmet: Yes | Available: Yes
✅ Test Case 7: Return a Vehicle
Enter your choice: 4
Enter registration number to return: ABC123
Vehicle ABC123 has been returned and is now available.
✅ Test Case 8: Display After Return
Enter your choice: 2
--- Available Vehicles ---
[Car] Reg#: ABC123 | Brand: Toyota | AC: Yes | Available: Yes
[Car] Reg#: XYZ789 | Brand: Honda | AC: No | Available: Yes
[Motorcycle] Reg#: MOTO456 | Brand: Yamaha | Helmet: Yes | Available: Yes
✅ Test Case 9: Exit
Enter your choice: 5
Exiting system. Goodbye!
🔍 Grading Rubric (Total: 30 Marks)
Category Criteria Marks
1. Object-Oriented Design Base class Vehicle with appropriate attributes and 3
(OOP) methods
Correct and complete implementation of derived 3
classes ( Car , Motorcycle , Truck )
Use of polymorphism where applicable 2
2. Functional Features Add new vehicle functionality (all types with proper 3
attributes)
Display available vehicles correctly 3
Rent a vehicle: availability check + rental cost 3
calculation
Return a rented vehicle: status update to available 2
3. Menu-Driven Interface Properly structured user interface with all options 2
(add, display, rent, return, exit)
Input validation and smooth flow 2
4. Code Quality & Structure Code readability, comments, meaningful naming 2
Proper file naming as per instructions 1
5. Test Case Coverage Evidence of correctly working features via sample 2
input/output
6. Bonus / Edge Case Handling duplicate registration, unavailable vehicle +2
Handling (optional) rent, invalid inputs (bonus)
💡 Notes:
Deductions should be made for hardcoding values, improper use of inheritance, or missing major
functionalities.
If plagiarism or AI-generated content is suspected, award 0 marks as per the assignment rules.