Java代写:CS103 Car Rental



You are tasked with creating a car-rental app.

  • There can be multiple cars with the same model and manufacturer.
  • The status of a car in the system may have one of the three values :
    • “reserved”
    • “checked out”
    • “available”
  • A user can reserve a car or rent a car without a previous reservation. A user is not allowed to have more than one car rented at a time. Only after canceling a reservation or returning a rented car, can a user can reserve or rent another car.
  • The reservation process is automatic, and does not require an admin to approve requests. If the status of a car is “available” and a user rents it, the status of that car immediately transitions to “reserved”. But an admin can edit the reservation later.
  • When a reservation is made, it must specify the time that the car is to be picked up (“checked out”) and returned. In order to simulate checkout and returns actions in the real world, there should be buttons that a user can manually click to indicate that a car has been checked out or returned.
  • The minimum rental period is 1 hour and the maximum is 10 hours. The system should cancel a reservation if a user doesn’t check out a car in time. The time elasticity is 30 minutes after the pickup time. For example, if a user reserved a car to pick up at 3:00pm, if the car was not checked out by 3:31pm, then the car should become “available” again.
  • If a user doesn’t return a car on the date promised when it was checked out, the system will sent a notification (e.g. system message) to the user and automatically change the car status to “available”.
  • A user can only reserve a car 7 days in the future.
  • A user can return a car before the specified return time by clicking the “return” button. If a user does this, then the car should become “available”.
  • There’s no elasticity in the return time. If the user doesn’t return the car in time (at the specified return time), the car will automatically become “available” and other users can check out this car. For example, user A reserves a car from 2pm to 4pm, user B reserves the same car from 4pm to 6pm. If A doesn’t return the car at 4pm, the system should automatically change the car status to “reserved” and user B can click “check out” button to pick up the car. If no user has reserved this car at 4pm, then the car should automatically become “available”.
  • There’s no penalty when a user doesn’t return a car. This app just has a simple payment system. A penalty would only make the calculation more complex.
  • The rental charge in user profile is not a deposit. It’s the total fee for the previous successful rental. The system doesn’t need to check if a user has enough on deposit to check out a car because there’s no deposit in this app.

A Car will have the following attributes

  • License-plate number (a 7-digit string unique for each Car)
  • Manufacturer
  • Model (String …this app doesn’t need to validate that the model is actually produced by the indicated manufacturer.)
  • Hourly Rental rate
  • Style (Coupe, Sedan or SUV)
  • Location (office where the car can be picked up)
  • Status to indicate availability:
    • Checked out - when a customer checks out the car or an admin checks out the car on behalf of a customer
    • Available - otherwise