123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
-
- /**
- * 4.2 Scientific Calculator Group Project
- * Trinh Tong, Lauren Green, Michelle Dimarino
- * Advanced Calculator Menu
- *
- * TO DO
- *
- * Add MainMenu class - displays mainmenu / calls back to main menu
- */
- public class SciCalc
- {
-
- 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
- Trig trigMenu = new Trig();
- }
- }
|