1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
-
- /**
- * 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 double NumberOne(){
- // String getFirst = Console.getStringInput("Please enter number.");
- // currentNumber = Console.getNumber(getFirst);
- // return currentNumber;
- // }
-
- public static double add(double x, double y){
- //CALULATES THE SUM OF TWO NUMBERS
- Console.currentNumber = x + y;
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double sub(double x, double y){
- //CALULATES THE DIFFERENCE OF TWO NUMBERS
- Console.currentNumber = x - y;
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double mul(double x, double y){
- //CALULATES THE PRODUCT OF TWO NUMBERS
- Console.currentNumber = x * y;
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double div(double x, double y){
- //CALULATES THE QUOTIENT OF TWO NUMBERS
- Console.currentNumber = x / y;
- if(y == 0){
- System.out.println("Err");
- Console.currentNumber = 0;
- }
- return Console.currentNumber;
- }
-
- public static double squ(double x){
- //CALULATES THE SQUARE OF ONE NUMBER
- //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
- Console.currentNumber = Math.pow(x,2);
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double sqrt(double x){
- //CALULATES THE SQUARE ROOT OF ONE NUMBER
- //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
- Console.currentNumber = Math.sqrt(x);
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double exp(double x, double y){
- //CALULATES EXPONENTIATION OF X TO POWER OF Y
- //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
- Console.currentNumber = Math.pow(x,y);
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double inv(double x){
- //CALULATES THE INVERSE OF NUMBER
- //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
- Console.currentNumber = (1/x);
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- public static double invert(double x){
- //TURNS NEGATIVE TO POSITIVE OR POSITIVE TO NEGATIVE
- Console.currentNumber = -x;
- //System.out.println(currentNumber);
- return Console.currentNumber;
- }
-
- }
|