A calculator that only supports an Add operation given a single formatted string
- C# console application
- Includes unit tests
- Show each step as a separate commit
- Efficient code is always important but for this excercise readability and separation of concerns are much more critical
- Not including one or more of the stretch goals will not affect your overall assessment but implementing them poorly will
- Support a maximum of 2 numbers using a comma delimiter. Throw an exception when more than 2 numbers are provided
- examples:
20
will return20
;1,5000
will return5001
;4,-3
will return1
- empty input or missing numbers should be converted to
0
- invalid numbers should be converted to
0
e.g.5,tytyt
will return5
- examples:
- Remove the maximum constraint for numbers e.g.
1,2,3,4,5,6,7,8,9,10,11,12
will return78
- Support a newline character as an alternative delimiter e.g.
1\n2,3
will return6
- Deny negative numbers by throwing an exception that includes all of the negative numbers provided
- Make any value greater than 1000 an invalid number e.g.
2,1001,6
will return8
- Support 1 custom delimiter of a single character using the format:
//{delimiter}\n{numbers}
- examples:
//#\n2#5
will return7
;//,\n2,ff,100
will return102
- all previous formats should also be supported
- examples:
- Support 1 custom delimiter of any length using the format:
//[{delimiter}]\n{numbers}
- example:
//[***]\n11***22***33
will return66
- all previous formats should also be supported
- example:
- Support multiple delimiters of any length using the format:
//[{delimiter1}][{delimiter2}]...\n{numbers}
- example:
//[*][!!][r9r]\n11r9r22*hh*33!!44
will return110
- all previous formats should also be supported
- example:
- Display the formula used to calculate the result e.g.
2,,4,rrrr,1001,6
will return2+0+4+0+0+6 = 12
- Allow the application to process entered entries until Ctrl+C is used
- Allow the acceptance of arguments to define...
- alternate delimiter in step #3
- toggle whether to deny negative numbers in step #4
- upper bound in step #5
- Use DI
- Support subtraction, multiplication, and division operations