Last active
August 29, 2015 14:05
-
-
Save rubaiyat6370/a20e2c313df5c76494dd to your computer and use it in GitHub Desktop.
Assignment of OOP1 on making a Basic Calculator
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
package edu.univdhaka.iit.calculator; | |
public class BasicCalculator { | |
/** | |
* | |
* Receives infinite parameter | |
* | |
**/ | |
public double addition(int...a) { | |
double sum=0; | |
for(double i:a) | |
sum=sum+i; | |
return sum; | |
} | |
public double multiplication(int...a) { | |
double result=1; | |
for(double i:a) | |
result=(result*i); | |
return result; | |
} | |
/** | |
* | |
* Receives two parameter | |
* | |
**/ | |
public int subtraction(int a, int b) { | |
return a - b; | |
} | |
public float division(int a, int b) { | |
return (float)a/b; | |
} | |
public double power(int a,int b){ | |
return Math.pow(a,b); | |
} | |
/** | |
* | |
* Receives one parameter | |
* | |
**/ | |
public double percent(int a){ | |
return (double)a/100; | |
} | |
public double sqrt(int a){ | |
return Math.sqrt(a); | |
} | |
public double square(int a){ | |
return a*a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment