123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import java.util.Scanner;
-
- /**
- * Created by leon on 2/9/18.
- */
- class Console {
-
- public static void print(String output, Object... args) {
- System.out.printf(output, args);
- }
-
- public static void println(String output, Object... args) {
- print(output + "\n", args);
- }
-
- public static String getStringInput(String prompt) {
- Scanner scanner = new Scanner(System.in);
- println(prompt);
- String userInput = scanner.nextLine();
- return userInput;
- }
-
- public static int getIntegerInput(String prompt) {
- Scanner scanner = new Scanner(System.in);
- println(prompt);
- int userInput = scanner.nextInt();
- return userInput;
- }
-
- public static double getDoubleInput(String prompt) {
- Scanner scanner = new Scanner(System.in);
- println(prompt);
- double userInput = scanner.nextDouble();
- return userInput;
- }
-
- public static int getOperationType(double z) {
-
- int i = Console.getIntegerInput(String.format("\n" + "What would you like to with your current operand? (Choose a number)" +
- "\n" + "1. Add | 2. Subtract | 3. Multiply | 4. Divide | 5. Square | 6. Square Root " +
- "\n" + "7. Exponential | 8. Inverse | 9. Invert | 10. Trigonometry | 11. QUIT" + "\n" +
- "CURRENT OPERAND: %.2f", z));
- return i;
- }
-
- public static int getTrigType() {
-
- int i = Console.getIntegerInput(String.format("\n" + "What trigonometric function would you like performed? (Choose a number)" + "\n" +
- "12. Sine | 13. Cosine | 14. Tangent" + "\n" +
- "15. Inverse Sine | 16. Inverse Cosine | 17. Inverse Tangent" + "\n"));
- return i;
- }
-
- public static double getSecondInput() {
- double y = Console.getDoubleInput("Please input your second number: ");
- return y;
- }
-
- public int switchDisplayMode() {
-
- int i = Console.getIntegerInput("Select your display mode:\n1. Binary \n2. Octal \n3. Decimal \n4. Hexadecimal");
- return i;
- }
- }
-
|