12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import java.util.Scanner;
  2. //Changed all int to double. If a decimal was entered first, it would
  3. //create an error.
  4. public class Console {
  5. public static void print(String output, Object... args) {
  6. System.out.printf(output, args);
  7. }
  8. public static void println(String output, Object... args) {
  9. print(output + "\n", args);
  10. }
  11. public static String getStringInput(String prompt) {
  12. Scanner scanner = new Scanner(System.in);
  13. println(prompt);
  14. String userInput = scanner.nextLine();
  15. return userInput;
  16. }
  17. public static Integer getIntegerInput(String prompt) {
  18. Scanner scanner = new Scanner(System.in);
  19. println(prompt);
  20. int userInput = scanner.nextInt();
  21. return userInput;
  22. }
  23. //Created a new user input for the doubles.
  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. }