Goal: Create a calculator that takes a variable number of strings, converts them to integers, and returns the sum
- Create a
StringCalculator
class with anadd()
method. The add method should return0
when the input is empty
StringCalculator.add() --> 0
add(number)
should return the number as an integer
StringCalculator.add('12') --> 12
add(a, b)
should return the sum of the numbers
StringCalculator.add('7', '4') --> 11
add(n1, n2, n3, ...ni)
should return the sum of the numbers
StringCalculator.add('1', '3', 5', '2') --> 11
- Strings should be parsed by
IntegerParser.parse(String number)