123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- /**
- * Created by leon on 2/9/18.
- */
- public class MainApplication {
-
-
- public static void main(String[] args) {
-
-
- Console console = new Console();
- CoreFeatures core = new CoreFeatures(console);
- ScientificFeatures science = new ScientificFeatures(console);
- BonusFeatures bonus = new BonusFeatures(console);
- CustomFeatures custom = new CustomFeatures(console);
-
- String onOff = "on";
- console.clearCurrentValue();
- System.out.printf("Welcome To The Calculator! \n" +
-
- ("Current Value Is: " + console.getCurrentValue() + "\n")) ;
-
- while(onOff == "on"){
-
- switch(console.getStringInput("What would you like to do? Enter 'HELP' for options. \n")){
- case "getvalue": console.getCurrentValue();
- break;
- case "clear": console.clearCurrentValue();
- break;
- case "changevalue":
- console.changeCurrentValue(console.getDoubleInput("What Would You Like To Change Current Value To? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- break;
- case "add":
- core.add(console.getDoubleInput("What Would You Like To Add to Current Value? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- //core.add(console.getDoubleInput("What Would You Like To Add to Current Value? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n")));
- break;
- case "subtract":
- core.subtract(console.getDoubleInput("What Would You Like To Subtract from Current Value? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- break;
- case "multiply":
- core.multiply(console.getDoubleInput("What Would You Like To Multiply Current Value By? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- break;
- case "divide":
- core.divide(console.getDoubleInput("What Would You Like To Divide Current Value By? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- break;
- case "square": core.square();
- break;
- case "sqrt" : core.squareRoot();
- break;
- case "inverse": core.inverse();
- break;
- case "invert": core.changeSign();
- break;
- case "variableex" : core.variableExponentiation(console.getDoubleInput
- ("What Power Should Current Value Be Raised To? \n" + "All Inputs Should Be In Base 10/ Decimal Format \n"));
- break;
- case "switchdisplaymode": science.switchDisplayMode
- (console.getStringInput("Which Mode Would You Like To Enter: Binary, Octal, Decimal, or Hexadecimal"));
- break;
- case "switchunitsmode": science.switchUnitsMode
- (console.getStringInput("Which Trig Units Would You Like: Degrees or Radians?"));
- break;
- case "m+": console.mPlus(console.getCurrentValue());
- break;
- case "mc": console.mClear();
- break;
- case "mrc": console.mRc();
- break;
- case "sine": science.sine(console.getCurrentValue());
- break;
- case "cosine": science.cosine(console.getCurrentValue());
- break;
- case "tangent": science.tangent(console.getCurrentValue());
- break;
- case "inversesine": science.invSine(console.getCurrentValue());
- break;
- case "inversecosine": science.invCosine(console.getCurrentValue());
- break;
- case "inversetangent": science.invTangent(console.getCurrentValue());
- break;
- case "factorial": bonus.factorialOf(console.currentValue);
- break;
- case "log": bonus.logarithm(console.getCurrentValue());
- break;
- case "inverselog": bonus.invLogarithm(console.getCurrentValue());
- break;
- case "ln": bonus.lnLogarithm(console.getCurrentValue());
- break;
- case "inverseln": bonus.expLogarithm(console.getCurrentValue());
- break;
- case "addfive": custom.addFive();
- break;
- case "help": console.println(custom.helpMe());
- break;
- case "exit": onOff = "off";
- break;
- default : console.println("Invalid choice please try again");
- break;
-
- }
- console.println("Current Mode Is: " + science.displayMode);
- console.println("Current Trig Units are: " + science.trigOptions);
-
- if(console.getCurrentValue() != Double.POSITIVE_INFINITY){
- if(console.getCurrentValue() != Double.NEGATIVE_INFINITY){
- if (science.Mode == 2){
-
- console.println("Current Value Is: " + Long.toBinaryString(Double.doubleToRawLongBits(console.getCurrentValue())));
- } else if( science.Mode == 8) {
-
- console.println("Current Value Is: " + Long.toOctalString(Double.doubleToRawLongBits(console.getCurrentValue())));
- }
- else if( science.Mode == 16) {
-
- console.println("Current Value Is: " + Double.toHexString(console.getCurrentValue()));
- } else {
- console.println("Current Value Is: " + Double.toString(console.getCurrentValue()));}
-
- }else {console.println("ERR Please CLEAR To Continue!");}
- }else {console.println("ERR Please CLEAR To Continue!");}
- }
- }
- }
-
|