12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import java.util.Scanner;
- //Changed all int to double. If a decimal was entered first, it would
- //create an error.
-
-
- public 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 Integer getIntegerInput(String prompt) {
- Scanner scanner = new Scanner(System.in);
- println(prompt);
- int userInput = scanner.nextInt();
- return userInput;
- }
- //Created a new user input for the doubles.
- public static Double getDoubleInput(String prompt) {
- Scanner scanner = new Scanner(System.in);
- println(prompt);
- double userInput = scanner.nextDouble();
- return userInput;
- }
-
-
-
-
-
-
- }
|