Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3. public class HelenGiven {
  4. final static Scanner kb = new Scanner(System.in);
  5. public static void main(String[] args) throws FileNotFoundException {
  6. // TODO Auto-generated method stub
  7. boolean exit = false;
  8.  
  9. while (exit == false) {
  10. System.out.println("1. Add a Class Session");
  11. System.out.println("2. Show Times all Classes");
  12. System.out.println("3. Show Instructor Payments Due");
  13. System.out.println("4. Print TimeTable for Instructor");
  14. System.out.println("5. Show Ordered TimeTable with Codes");
  15. System.out.println("6. Exit");
  16.  
  17. int choice = kb.nextInt();
  18. kb.nextLine();
  19. switch (choice) {
  20.  
  21. case 1:
  22.  
  23. break;
  24. case 2:
  25.  
  26. break;
  27. case 3:
  28.  
  29. break;
  30. case 4:
  31. break;
  32. case 5:
  33. break;
  34. case 6:
  35. exit = true;
  36. break;
  37. }
  38. System.out.println("\nPress Return to continue");
  39. kb.nextLine();
  40. }
  41.  
  42. }
  43.  
  44.  
  45. private static void printTitle(String name) {
  46. System.out.println("The Goto Gym " + name );
  47. System.out.println("-------------------------\n");
  48. }
  49.  
  50. /**
  51. *
  52. * @param p,
  53. * prompt
  54. * @return a non-empty string
  55. */
  56. public static String readString(String p) {
  57. String r;
  58. do {
  59. System.out.print(p);
  60. r = kb.nextLine();
  61. } while (r.length() == 0);
  62. return r;
  63. }
  64.  
  65. public static int readIntInRange(String question, int min, int max) {
  66. int choice = -1;
  67. System.out.print(question);
  68. boolean valid = false;
  69. while (!valid) {
  70. while (!kb.hasNextInt()) {
  71. kb.nextLine();
  72. System.out.println("ERROR - must be integer");
  73. System.out.println(question);
  74. }
  75. choice = kb.nextInt();
  76. kb.nextLine();
  77. if (choice >= min && choice <= max) {
  78. valid = true;
  79. }
  80. }
  81. return choice;
  82. }
  83.  
  84. /**
  85. * Reads an integer value from the console window
  86. *
  87. * @param question,
  88. * question to be asked of the user
  89. * @return An integer value is returned.
  90. */
  91. public static int readInt(String question) {
  92. int choice;
  93. System.out.print(question);
  94. while (!kb.hasNextInt()) {
  95. kb.nextLine();
  96. System.out.println("ERROR - must be integer");
  97. System.out.println(question);
  98. }
  99. choice = kb.nextInt();
  100. kb.nextLine();
  101. return choice;
  102. }
  103.  
  104. /**
  105. * Reads an integer value from the console window
  106. *
  107. * @param question,
  108. * question to be asked of the user
  109. * @return An integer value is returned.
  110. */
  111. public static double readDouble(String question) {
  112. double choice;
  113. System.out.print(question);
  114. while (!kb.hasNextDouble()) {
  115. kb.nextLine();
  116. System.out.println("ERROR - must be number");
  117. System.out.println(question);
  118. }
  119. choice = kb.nextDouble();
  120. kb.nextLine();
  121. return choice;
  122. }
  123.  
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement