/** * All features of CoreFeatures here. * * @author (David Thornley) * @version (0.1) */ import java.util.Scanner; public class CoreFeatures { // instance variables - replace the example below with your own private Console console = new Console(); /** * Constructor for objects of class CoreFeatures */ public CoreFeatures(Console c) { console = c; } public double add(double b) { return console.changeCurrentValue(console.getCurrentValue() + b); } public double subtract(double b) { return console.changeCurrentValue(console.getCurrentValue() - b); } public double multiply(double b) { return console.changeCurrentValue(console.getCurrentValue() * b); } public double divide(double b) { if ( b != 0){ return console.changeCurrentValue(console.getCurrentValue() / b); }else {console.println("Cannot Divide by 0, Please Try Another Number."); } return console.getCurrentValue(); } public double square() { return console.changeCurrentValue( Math.pow(console.currentValue, 2)); } public double squareRoot() { return console.changeCurrentValue( Math.sqrt(console.currentValue)); } public double inverse() { return console.changeCurrentValue( (1/console.currentValue)); } public double changeSign() { return console.changeCurrentValue((console.currentValue *= -1)); } public double variableExponentiation(double b) { return console.changeCurrentValue(Math.pow(console.currentValue,b)); } }