Skip to content

HackatonEpm/Line-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

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:
    1. add(number)
    2. subtract(number)
    3. multiply(number)
    4. devide(number)
    5. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published