Skip to content

Car dealership: Created classes, including their properties and behaviours, using JavaScript.

Notifications You must be signed in to change notification settings

ramirorichmand/Lab17_01.03.23_ConstructorsAndPrototypes_JavaScript

Repository files navigation

Lab Exercise 01/03/23 - Constructors & Prototypes

In this exercise we explored some of the differences between how classes are defined in Java and JavaScript. Used a car dealership format and created the classes, including their properties and behaviours, using JavaScript.

Created project from scratch and installed dependencies (hint: npm install -D jest).

Task

  • Created Car class. The car has properties representing manufacturer, price and engine type.
  • Set up Jest and wrote tests to ensure accessibility to each of the properties in a Car object.
  • Created a Dealership class. It contains properties representing its name, maximum number of cars it has and the cars currently in stock.
  • Added methods to Dealership to:
    • Counted the number of cars in stock
    • Added a car to stock
    • Returned an array containing each car's manufacturer
    • Found all the cars from a given manufacturer
    • Found the total value of all the cars in stock
  • Wrote tests for Dealership's methods.

About

Car dealership: Created classes, including their properties and behaviours, using JavaScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published