/** * Write a description of class CoreFeatures here. * * @author (your name) * @version (a version number or a date) */ public class CoreFeatures extends MainApplication { // instance variables - replace the example below with your own private double x; private double addedNumbers; //addition private double subtractedNumbers; //subtraction private double multipliedNumbers; //multiplication private double dividedNumbers; //divide private double squaredNumber; //square private double squareRoot; //square root private boolean calcRunning; //calculator status private double invertedNumber; //changing the sign of a number /** * Constructor for objects of class CoreFeatures */ public CoreFeatures(){ // initialise instance variables x = 0; } public double addNumbers(double adding1, double adding2){ addedNumbers = adding1 + adding2; return addedNumbers;} public double subtractNumbers(double subtracting1, double subtracting2){ subtractedNumbers = subtracting1 - subtracting2; return subtractedNumbers;} public double multiplyNumbers(double multiplying1, double multiplying2){ multipliedNumbers = multiplying1 * multiplying2; return multipliedNumbers;} public double divideNumbers(double dividing1, double dividing2){ if (dividing2 == 0){ System.out.println("**ERROR** CANNOT DIVIDE BY ZERO.");} else { dividedNumbers = dividing1 / dividing2; return dividedNumbers;} /*double userCorrectedInput = Console.getDoubleInput("**Err** CANNOT DIVIDE BY ZERO. Please clear the calculator."); return userCorrectedInput;*/ /*dividedNumbers = dividing1 / dividing2; return dividedNumbers;*/ return dividedNumbers;} public double squareNumber(double squaring){ squaredNumber = squaring * squaring; return squaredNumber;} public double squareRoot(double squareRooting){ squareRoot = squareRoot(squareRooting); return squareRoot;} public double invertSign(double inverting){ invertedNumber = inverting * -1; return invertedNumber; } public boolean calcRunning(){ calcRunning = false; return calcRunning; } }