/calculator-methods-HaniFikry

calculator-methods-HaniFikry created by GitHub Classroom

Primary LanguageRuby

The Calculator

Basic Operations

Write methods for following arithmatic operations, each method takes 2 inputs the first operand and the second operand:

  • Addition
  • Subtraction
  • Multiplication
  • Divide

Get User input

Write a method that asks the user for the 2 operands and the operation they want to perform, and accordingly calls the corresponding method and displays the result.

Take it a little further ( Advanced )

Add the Method Power as one of the mathmatical operations that your calculator accepts. (This is the symbol used for power ^) Implement the method for power using 2 different ways:

  • Search for a predefined method to calculate the power
  • Implement the power using multiplication such that m^n = m*m*m..*m (ntimes) i.e. 2^4 = 2*2*2*2