Skip to content

Latest commit

 

History

History
30 lines (27 loc) · 978 Bytes

README.md

File metadata and controls

30 lines (27 loc) · 978 Bytes

TddCalculator

The Tdd Calculator is a exercise to create a calculator class using the following specs

  • the calculator should have a add method that adds the result to the current total returns the total
  • the calculator should have a subtract method that subtracts the result from the current total returns the total
  • the calculator should have a multiply method that multiplies the current total and returns the total
  • the calculator should have a divide method that divides the current total and returns the total
  • the calculator should throw a exception with the text 'cannot divide by zero' when a divide by zero exception occurs
  • the calculator should have a calculate function that returns a formatted string with all calculations and the endresult

example of formatted text

         1
        +4
----------
sub      5
        -2
----------
sub      3
        *3
----------
sub      9
        /2
----------
sub    4,5
        +1
----------
total  5,5