Object Oriented Programming Challenge - Scooter Hire System
Learning Objectives
Demonstrate what you have learnt in this Unit by creating UML diagrams, classes and unit tests for a new domain.
Pre-requisites
Completion of this unit's lessons
Lesson
You have been asked to design an Electric Scooter Hire app system. The requirements for the system are as follows:
To hire a scooter, a user must download the Electric Scooter Hire app and register their details
Only users 18 years and above can ride a scooter
Scooters are rented from charging stations
There are multiple charging stations in the city
Only fully charged scooters can be rented
A scooter must be returned to a charging station
It takes 2 hours to fully charge a scooter from empty
Payment is taken once the user has returned their scooter
A scooter can be marked by a user as broken. This must remove the scooter from a list of available scooters and trigger maintenance personnel to repair the scooter
The maximum range of a fully charged scooter is 32 km
Assignment
To complete the assignment you must create the following:
Design your solution by creating the following UML diagrams:
A UML Use Case diagram showing the interactions between the user Actor, scooter Actor and the Electric Scooter Hire app system
A UML Class diagram showing the system's classes, their attributes, methods and inter-relationships
A UML Sequence diagram showing the interactions between the user Actor, the Scooter Actor and the classes in the system
Screenshots of your UML diagrams must be committed to your Github repository. You may want to get the diagrams checked by your coach before starting to code.
Implement your system as follows:
A /src directory containing classes with interactions (methods calls) that capture the required functionality
A /tests directory containing unit tests (including async tests for the charging functionality) which test all scenarios
A screenshot of your unit test coverage report (aim for 100% coverage)
Commit your code into Github and share the link with your coach for review.
Hint - in Javascript, to simulate waiting for a scooter to charge you can make use of the setTimeout call for example:
test("charge", async () => {
const scooter = new Scooter();
await scooter.charge(); // we need to wait for the charge!console.log("Test complete");
});
Assignment extension tasks
Use the PlantUML documentationalt/else syntax to extend your UML Sequence diagrams to include the handling of error conditions such as the scooter breaking when the user has started the hire period.