MainApplication.java 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Created by leon on 2/9/18.
  3. */
  4. import java.util.*;
  5. public class MainApplication {
  6. public static void main(String[] args) {
  7. // Create all instances of classes to be used for this program
  8. MainMenu mainMenu = new MainMenu();
  9. SciCalc scientificCalc = new SciCalc();
  10. MemoryFunc memory = new MemoryFunc();
  11. SwitchDisplay baseChange = new SwitchDisplay();
  12. // Stored memory value should be able to be used throughout whole application
  13. Double memoryValue = memory.memory;
  14. // if any input = "m", that input now = the memory value
  15. // Menu Input
  16. String menuInput = " ";
  17. // Giant while loop that links back to main menu
  18. while (!menuInput.equals("4")) {
  19. mainMenu.mainMenuDisplay();
  20. menuInput = Console.getStringInput("Enter the calculator you want to use by key. (ie. 1 for basic, etc.)");
  21. switch (menuInput) {
  22. case "1":
  23. // Sends to basic calculator functions
  24. break;
  25. case "2":
  26. // Sends to Advanced Calculator Functions
  27. break;
  28. case "3":
  29. // Sends to Scientific Calculator Functions
  30. // displays the menu for scientific calc
  31. scientificCalc.toSciMenu();
  32. String sciMenuInput = Console.getStringInput("Enter the function you'd like to use by key.");
  33. // if statement to use various calc functions
  34. if (sciMenuInput.equals("1")) {
  35. // Base Conversions
  36. baseChange.switchDisplay();
  37. } else if (sciMenuInput.equals("2")) {
  38. // Memory
  39. memory.memoryMenu();
  40. } else if (sciMenuInput.equals("3")) {
  41. // To Trig Menu
  42. } else {
  43. break;
  44. }
  45. break;
  46. case "4":
  47. // Quits the calculator
  48. break;
  49. }
  50. }
  51. Console.println("Welcome to my calculator!");
  52. /** String s = Console.getStringInput("Enter a string");
  53. Integer i = Console.getIntegerInput("Enter an integer");
  54. Double d = Console.getDoubleInput("Enter a double.");
  55. Console.println("The user input %s as a string", s);
  56. Console.println("The user input %s as a integer", i);
  57. Console.println("The user input %s as a d", d);
  58. */
  59. }
  60. }