Created
October 9, 2018 17:55
-
-
Save sevperez/0ea36e2e5daa51b43325a0012b66c733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IArithmetic | |
{ | |
int Add(int num1, int num2); | |
int Subtract(int num1, int num2); | |
int Multiply(int num1, int num2); | |
double Divide(int num1, int num2); | |
} | |
interface IExponents | |
{ | |
double Power(double num, double power); | |
double SquareRoot(double num); | |
} | |
class BasicCalculator : IArithmetic | |
{ | |
public int Add(int num1, int num2) | |
{ | |
return num1 + num2; | |
} | |
public int Subtract(int num1, int num2) | |
{ | |
return num1 - num2; | |
} | |
public int Multiply(int num1, int num2) | |
{ | |
return num1 * num2; | |
} | |
public double Divide(int num1, int num2) | |
{ | |
return (double)num1 / (double)num2; | |
} | |
} | |
class AdvancedCalculator : IArithmetic, IExponents | |
{ | |
public int Add(int num1, int num2) | |
{ | |
return num1 + num2; | |
} | |
public int Subtract(int num1, int num2) | |
{ | |
return num1 - num2; | |
} | |
public int Multiply(int num1, int num2) | |
{ | |
return num1 * num2; | |
} | |
public double Divide(int num1, int num2) | |
{ | |
return (double)num1 / (double)num2; | |
} | |
public double Power(double num, double power) | |
{ | |
return Math.Pow(num, power); | |
} | |
public double SquareRoot(double num) | |
{ | |
return Math.Sqrt(num); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment