123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import java.util.Scanner;
  2. /**
  3. * Created by leon on 2/9/18.
  4. */
  5. class Console {
  6. public static void print(String output, Object... args) {
  7. System.out.printf(output, args);
  8. }
  9. public static void println(String output, Object... args) {
  10. print(output + "\n", args);
  11. }
  12. public static String getStringInput(String prompt) {
  13. Scanner scanner = new Scanner(System.in);
  14. println(prompt);
  15. String userInput = scanner.nextLine();
  16. return userInput;
  17. }
  18. public static int getIntegerInput(String prompt) {
  19. Scanner scanner = new Scanner(System.in);
  20. println(prompt);
  21. int userInput = scanner.nextInt();
  22. return userInput;
  23. }
  24. public static double getDoubleInput(String prompt) {
  25. Scanner scanner = new Scanner(System.in);
  26. println(prompt);
  27. double userInput = scanner.nextDouble();
  28. return userInput;
  29. }
  30. public static int getOperationType(double z) {
  31. int i = Console.getIntegerInput(String.format("\n" + "What would you like to with your current operand? (Choose a number)" +
  32. "\n" + "1. Add | 2. Subtract | 3. Multiply | 4. Divide | 5. Square | 6. Square Root " +
  33. "\n" + "7. Exponential | 8. Inverse | 9. Invert | 10. Trigonometry | 11. QUIT" + "\n" +
  34. "CURRENT OPERAND: %.2f", z));
  35. return i;
  36. }
  37. public static int getTrigType() {
  38. int i = Console.getIntegerInput(String.format("\n" + "What trigonometric function would you like performed? (Choose a number)" + "\n" +
  39. "12. Sine | 13. Cosine | 14. Tangent" + "\n" +
  40. "15. Inverse Sine | 16. Inverse Cosine | 17. Inverse Tangent" + "\n"));
  41. return i;
  42. }
  43. public static double getSecondInput() {
  44. double y = Console.getDoubleInput("Please input your second number: ");
  45. return y;
  46. }
  47. public int switchDisplayMode() {
  48. int i = Console.getIntegerInput("Select your display mode:\n1. Binary \n2. Octal \n3. Decimal \n4. Hexadecimal");
  49. return i;
  50. }
  51. }