1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
-
- /**
- * 4.2 Scientific Calculator Group Project
- * Trinh Tong, Lauren Green, Michelle Dimarino
- * Advanced Calculator Menu
- */
- public class AdvCalc
- {
-
- private double memory = 0;
-
- /**
- * Switch Display Mode method
- * -> binary, octal, decimal, hexadecimal
- * switchDisplayMode() rotates through the options
- * switchDisplayMode(String mode) sets the display to the mode given
- */
- public void switchDisplay(String mode)
- {
- int baseInput = Console.getIntegerInput("Enter an integer to see the base conversions.");
-
- Console.println("Display Options"
- + "\nBinary: " + null
- + "\nOctal: " + null
- + "\nDecimal: " + null
- + "\nHexadecimal: " + null
- + "\n");
-
- mode = Console.getStringInput("Enter the base option to display.");
- if (mode.toLowerCase().equals("binary") == true) {
-
- } else if (mode.toLowerCase().equals("octal") == true) {
-
- }
-
-
- }
-
- /**
- * Converts the user input into octal and returns a string of that octal.
- */
- public String toOctal(int userInput) {
-
- return Integer.toOctalString(userInput);
-
- }
- /**
- * Store 1 numeric value in memory for recall later
- * M+ = add currently displayed value to the value in memorie (default = 0)
- * MC = reset memory
- * MRC = recall current valie from memory to display
- */
- public void memory()
- {
- // Memory menu
- Console.println("Memory Mode");
- // Ask for input of a number
- double memoryInput = Console.getDoubleInput("Enter a number to store. ");
- // Display memory keys
- Console.println("Memory Options: "
- + "\nM+ : adds input to memory"
- + "\nMC : clears current memory"
- + "\nMRC : displays current memory input");
-
- String memorySelect = Console.getStringInput("What would you like to do? (Enter the key)");
-
-
- if (memorySelect.equals("M+") == true) {
- // M+
- memory = memoryInput;
-
- } else if (memorySelect.equals("MC") == true) {
- // MC
- memory = 0;
-
- } else if (memorySelect.equals("MCR") == true) {
- // MCR
- Console.println(Double.toString(memory));
-
- }
-
- }
-
-
- /**
- * To Trig -
- * sends user to trig functions of the calculator
- */
- public void toTrig(int y)
- {
- // calls the trig menu
-
- }
- }
|