Cruise ship project as part of the Manchester Codes curriculum which implements OOP, user stories and domain models, dependency injection & TDD with Jest (inc test doubles).
You can view the GUI version of the project here
- Clone this repo.
- Change in to repo directory.
- Run NPM install.
All ships need itineraries and all itineraries need ports.
Create an instance of the Port class and pass in the port name as an argument.
const dover = new Port("Dover");
Create an instance of the Itinerary class and pass in an array of Ports as an argument.
const itinerary = new Itinerary([dover, plymouth]);
Create an instance of the Ship class and pass in an Itinerary as an argument.
const ship = new Ship(itinerary);
All ships can sail, providing they are not at the last port in the itinerary.
ship.setSail();
All ships can come alongside.
ship.dock();
When alongside, the ship will be added to that ports "ships" array.