123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
- /**
- * Write a description of class simpleOp here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- import java.util.*;
- public class simpleOp
- {
- public static int add(int x, int y){
- //CALULATES THE SUM OF TWO NUMBERS
- int z = x + y;
- System.out.println(x + " + " + y + " = " + z);
- return z;
- }
-
- public static int sub(int x, int y){
- //CALULATES THE DIFFERENCE OF TWO NUMBERS
- int z = x - y;
- System.out.println(x + " - " + y + " = " + z);
- return z;
- }
-
- public static int mul(int x, int y){
- //CALULATES THE PRODUCT OF TWO NUMBERS
- int z = x * y;
- System.out.println(x + " * " + y + " = " + z);
- return z;
- }
-
- public static int div(int x, int y){
- //CALULATES THE QUOTIENT OF TWO NUMBERS
- int z = x / y;
- System.out.println(x + " / " + y + " = " + z);
- return z;
- }
-
- public static int squ(int x){
- //CALULATES THE SQUARE OF ONE NUMBER
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
- int z = (int) Math.pow(x,2);
- System.out.println(x + "\u00B2 = " + z);
- return z;
- }
-
- public static int sqrt(int x){
- //CALULATES THE SQUARE ROOT OF ONE NUMBER
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
- int z = (int) Math.sqrt(x);
- System.out.println("√" + x + " = " + z);
- return z;
- }
-
- public static int exp(int x, int y){
- //CALULATES EXPONENTIATION OF X TO POWER OF Y
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
- int z = (int) Math.pow(x,y);
- System.out.println(x + "^" + y + " = " + z);
- return z;
- }
-
- public static double inv(double x){
- //CALULATES THE INVERSE OF NUMBER
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
- double z = 1 / x;
- System.out.println("1 / " + x + " = " + z);
- return z;
- }
-
- public static int invert(int number){
- //TURNS NEGATIVE TO POSITIVE OR POSITIVE TO NEGATIVE
- int invertedNumber = -number;
- System.out.println(invertedNumber);
- return invertedNumber;
- }
-
- }
|