public class Calculator { // instance variables - replace the example below with your own private double displayValue; private double memoryValue; <<<<<<< HEAD //private CoreFeatures core; //private ScientificFeatures science; //private BonusFeatures bonus; ======= private boolean err; >>>>>>> 85cb6e118e199051f7fc22d59044b58cdf7dcf01 /** * Constructor for objects of class Calculator */ public Calculator() { displayValue = 0; memoryValue = 0; err = false; } //Memory set public double memSet(){ memoryValue = displayValue; return memoryValue; } public double memClear(){ memoryValue = 0; return memoryValue; } public double mrc(){ displayValue = memoryValue; return displayValue; } //Clear and retrieve display value public double clear(){ displayValue = 0; err = false; return displayValue; } public double getDisplayValue(){ return displayValue; } //basic functions public double add(double value1, double value2){ displayValue = value1 + value2; return displayValue; } public double subtract(double value1, double value2){ displayValue = value1 - value2; return displayValue; } public double multiply(double value1, double value2){ displayValue = value1 * value2; return displayValue; } public double divide(double dividend, double divisor){ displayValue = dividend / divisor; return displayValue; } public double pow(double base, double exponent){ displayValue = Math.pow(base, exponent); return displayValue; } public double square(double base){ return pow(base, 2); } public double squareRoot(double value){ displayValue = Math.sqrt(value); return displayValue; } public double inverse(double value){ displayValue = 1 / value; return displayValue; } public double changeSign(double value){ return multiply(value, -1); } //scientific functions public double sin(double value){ displayValue = Math.sin(value); return displayValue; } public double cos(double value) { displayValue = Math.cos(value); return displayValue; } public double tan(double value) { displayValue = Math.tan(value); return displayValue; } public double log(double value) { displayValue = Math.log(value); return displayValue; } public double inverseSin(double value) { displayValue = Math.log(value); return displayValue; } public double inverseCos(double value) { displayValue = Math.acos(value); return displayValue; } public double inverseTan(double value) { displayValue = Math.atan(value); return displayValue; } public double inverseLog(double value){ displayValue = Math.pow(value, 10); return displayValue; } public double naturalLog(double value) { displayValue = Math.log1p(value); return displayValue; } public double inverseLn(double value) { displayValue = Math.pow(Math.E, value); return displayValue; } public double displayPi() { displayValue = Math.PI; return displayValue; } public double displayE(){ displayValue = Math.E; return Math.E; } }