Giter VIP home page Giter VIP logo

line-calculator's Introduction

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

line-calculator's People

Contributors

hackatonepm avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.