Calculator


Project Created by Wyatt Schweitzer

Mission
To create several  functions that allow you to perform tasks typically done by a calculator

Details
Create six methods:

."add", which takes parameters "num1" and "num2" and returns num1+num2

."subtract", which takes parameters "a" and "b" and returns a-b,

."multiply", which takes parameters "x" and "y" that returns x*y,

."divide", which takes parameters "numerator" and "denominator" and returns numerator/denominator,

."squared", which takes only one parameter called "integer" and returns integer squared, and

."power_of" which take parameters "k" and "power" and returns k to the power of "power".

After these functions have been defined perform the following operations and print the results. Add 3 and 4, subtract 8 and 5, multiply 10 and 7, divide 6 by 2, square 5, and raise 2 to the power of 3.

Example Program
Your program will simply output the following values in this order.

7
3
70
3
25
8


No comments:

Post a Comment