Coding Dojo

Edit on Github

First step

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

double 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

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 :

"//[delimiter]\n[numbers]

Example :

"//;\n1;2"   => 3
"//|\n1|2|3" => 6

All existing scenarios should work as before.

Negatives numbers

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

"-1,2"    => Negative not allowed : -1
"2,-4,"

Others operations

Write a function for multiply with same rules