Object Oriented Programming Challenge - Scooter Hire System

Learning Objectives

Pre-requisites

Lesson

electric scooters parked on the pavement

You have been asked to design an Electric Scooter Hire app system. The requirements for the system are as follows:

Assignment

To complete the assignment you must create the following:

  1. Design your solution by creating the following UML diagrams:

    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.

  2. Implement your system as follows:

    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:

   async charge() {
        console.log('Starting charge');

        await new Promise(resolve => setTimeout(resolve, 2000)); // wait 2 seconds

        console.log('Charge complete');   
   }

The associated Jest test will look as follows:

    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 documentation alt/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.

Additional resources

Hiring a scooter using Dot (Video)