123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
-
-
-
-
-
-
- public class MathUtilities{
- /**
- * Add two number together
- * @param num1 first number
- * @param num2 second number
- * @return the sum of the two numbers
- */
- //add number one and two together
- // return the sum
-
- public int add(int num1, int num2){
-
- return (num1 + num2);
-
-
- }
-
- /**
- * Add two number together
- * @param num1 first number
- * @param num2 second number
- * @return the sum of the two numbers
- */
- public double add(double num1, double num2){
-
- return (num1 + num2);
-
- }
-
- /**
- * Get half the value of the number
- * @param number the number given
- * @return the half of the number in double
- */
- public double half(int number) {
- //if either number is a double the int will be converted into a double
- double d = (number/2.00);
-
- return d;
- }
-
- /**
- * Determine if the number is odd
- * @param number the number given
- * @return true if the number is odd, false if it is even
- */
-
-
- public boolean isOdd(int number){
-
-
-
- if (number % 2 == 0){ return false;
- }
- else return true;
-
- }
-
-
- /**
- * Multiply the number by itself
- * @param number the number given
- * @return the result of the number multiply by itself
- */
- public int square(int number) {
-
- return (number * number);
- }
-
- }
|