Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 686 Bytes

File metadata and controls

28 lines (20 loc) · 686 Bytes

JS TDD Lab

Directions

Using Test Driven Development(TDD), build the classes below. Remember, you need to write the test case before writing the source code when using TDD. You should have getters and setters for every attribute in a class.

Note: Getters, Setters, and Constructors do not need to be tested

Rectangle

  • getPerimeter()
  • getArea()
  • isSquare()

Calculator

  • getTotal()
  • add(num)
  • subtract(num)
  • multiply(num)
  • divide(num)
  • clear()

Tesla

  • getCharge()
  • charge(percentage) Increases the charge by the percent provide, max 100%
  • fullyCharge() Increases the charge to 100%
  • drive(miles) Note: The charge deplets 1% every 2 miles you drive