Coding Dojo

Edit on Github

String Calculator

First step

Create a function add they take a string and return a string like :

String add(String number)

Many numbers

Allow the add method to handle an unknow number of arguments

New separator

Allow the add method to handle new lines as separator

Missing number in last position

Many separator

Allow the add method to handle a different delimiter

To change the delimiter, the beginning of the string will contain a separate line that looks like this :


Example :

All existing scenarios should work as before.

Negatives numbers

Calling add with negatives numbers will return the message “Negative not allowed : “ listing all negative numbers that were in the list of numbers

Multiple errors

Calling add with multiple errors will return all errors message separated by new line.

Others operations

Write a function for multiply with same rules