Java assignment
OOP-JAVA(DCIT 201 - Graded Assignment)
Advanced Vehicle Rental Management System
Assignment Objective
Design a comprehensive Vehicle Rental Management System that demonstrates ALL Object-Oriented Programming (OOP) Principles:
Encapsulation
Inheritance
Polymorphism
Abstraction
Composition
Problem Domain: Vehicle Rental Management System
Core Requirements
- Abstraction Principle
Create an abstract base class Vehicle with the following abstract methods:
calculateRentalCost(int days)
isAvailableForRental()
2. Inheritance Hierarchy
Implement concrete vehicle classes that inherit from Vehicle:
Car (extends Vehicle)
Motorcycle (extends Vehicle)
Truck (extends Vehicle)
Each vehicle type must have unique rental characteristics:
Different base rental rates
Specific rental rules
Unique additional features
3. Encapsulation
Each vehicle class must:
Use private fields for critical information
Provide public getter and setter methods
Implement input validation in setters
Protect sensitive data from direct modification
4. Polymorphism Implementation
Create interfaces and method overriding:
Rentable interface with methods:
rent(Customer customer, int days)
returnVehicle()
Override methods in each vehicle class
Demonstrate method overloading and overriding
5. Composition
Design supporting classes:
Customer
RentalAgency
RentalTransaction
Detailed Class Requirements
Vehicle (Abstract Class)
public abstract class Vehicle {
// Private encapsulated fields
private String vehicleId;
private String model;
private double baseRentalRate;
private boolean isAvailable;
// Constructors with validation
// Getters and setters
// Abstract methods for rental calculation
}
Vehicle Specific Classes
Each vehicle class must implement unique:
Rental cost calculations
Availability checks
Special features
Customer Class
Manage customer rental history
Track current rentals
Implement rental eligibility checks
RentalAgency Class
Manage vehicle fleet
Process rentals
Generate reports
Implement complex business logic
Bonus Challenges
Implement a loyalty program using interfaces
Create custom exceptions for rental scenarios
Add a rating system for vehicles and customers
Additional OOP Principles to Demonstrate
Use of final keyword for immutability
Static factory methods
Composition over inheritance
Interface-based design
Specific Implementation Guidelines
Encapsulation Requirements
All fields must be private
Use constructor/setter validation
Provide controlled access through methods
Inheritance Requirements
Create a meaningful inheritance hierarchy
Use super() for parent class initialization
Override toString(), equals(), and hashCode()
Polymorphism Requirements
Implement method overriding
Use interfaces for flexible design
Create methods that accept base class/interface types
Abstraction Requirements
Use abstract classes and interfaces
Hide complex implementation details
Provide clean, intuitive public interfaces
Testing Requirements
Unit test each class independently
Test all possible scenarios
Validate encapsulation
Check inheritance and polymorphic behavior
Verify abstraction implementations
Evaluation Criteria
Correct implementation of OOP principles
Code quality and readability
Comprehensive test coverage
Innovative solution design
Error handling and validation
Submission Guidelines
Create a well-structured Maven/Gradle project
Use meaningful package structure
Include comprehensive unit tests
Write clean, documented code
Follow Java naming conventions
Recommended Tools
JDK 11+
Maven/Gradle
JUnit 5
Mockito (optional)