Line-Calculator
Your task is to implement class Line Calculator.
The priority of different operations should be kept in mind. It means, that 2 + 2 * 2 is 6, not 8.
Details:
- create class LineCalculator
- init class default value (number)
- add methods:
- add(number)
- subtract(number)
- multiply(number)
- devide(number)
- pow(number)
- when we use Line Calculator with NSlog() method, method should be print current result
- use MRC
Example:
LineCalculator *calc = [LineCalculator defaultValue:@2];
calc.add(@2).multiply(@2);
NSLog(@"%@", calc); // should be print 6
Test Data:
LineCalculator *calc = [LineCalculator defaultValue:@10];
calc.add(83); -> 93
LineCalculator *calc = [LineCalculator defaultValue:@4];
calc.pow(1).pow(1).pow(1).multiply(2).add(80).subtract(11).multiply(1).subtract(41).subtract(65); -> -29
LineCalculator *calc = [LineCalculator defaultValue:@6];
calc.add(14).subtract(16).add(36).multiply(1).subtract(46).add(57).pow(1); -> 51
LineCalculator *calc = [LineCalculator defaultValue:@10];
calc.pow(1).pow(1); -> 10
LineCalculator *calc = [LineCalculator defaultValue:@7];
calc.subtract(94).subtract(97).multiply(1).pow(1).multiply(1).pow(1).subtract(65).pow(1); -> -249
LineCalculator *calc = [LineCalculator defaultValue:@7];
calc.subtract(43).subtract(43).multiply(1).subtract(60).add(8).subtract(28); -> -159