Car Rental System
Car Rental System
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license
*/
package rentalsystem_composition_casestudy;
/**
*/
// Constructor
this.vehicleType = vehicleType;
this.make = make;
this.model = model;
this.rentalRatePerDay = rentalRatePerDay;
return vehicleType;
this.vehicleType = vehicleType;
return make;
this.make = make;
return model;
this.model = model;
return rentalRatePerDay;
}
public void setRentalRatePerDay(double rentalRatePerDay) {
this.rentalRatePerDay = rentalRatePerDay;
return "Vehicle Type: " + vehicleType + ", Make: " + make + ", Model: "
+ model;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license
*/
package rentalsystem_composition_casestudy;
/**
*/
// Constructor
this.vehicle = vehicle;
this.startDate = startDate;
this.endDate = endDate;
int counter=0;
for(int i=startDate.getDay();i<=day.length;i++)
counter++;
return counter;
}
// Method to calculate total rental charge
return vehicle.calculateRentalCharge(days);
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license
*/
package rentalsystem_composition_casestudy;
import java.time.LocalDate;
/**
*/
public class RENTALSYSTEM_COMPOSITION_CASESTUDY {
/**
*/
// Creating a customer
// Renting vehicles
customer.addRental(carRental);
customer.addRental(bikeRental);
customer.displayRentalHistory();
System.out.println("Total Charges: $" +
customer.calculateTotalCharges());
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license
*/
package rentalsystem_composition_casestudy;
/**
*/
this.day = day;
this.month = month;
this.year = year;
}
public int getDay() {
return day;
return month;
return year;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license
*/
package rentalsystem_composition_casestudy;
import java.util.ArrayList;
import java.util.List;
/**
*/
// Constructor
this.customerId = customerId;
this.name = name;
this.email = email;
rentals.add(rental);
double totalCharges = 0;
for (Rental rental : rentals) {
totalCharges += rental.calculateTotalRentalCharge();
return totalCharges;