Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class HelenGiven {
- final static Scanner kb = new Scanner(System.in);
- public static void main(String[] args) throws FileNotFoundException {
- // TODO Auto-generated method stub
- boolean exit = false;
- while (exit == false) {
- System.out.println("1. Add a Class Session");
- System.out.println("2. Show Times all Classes");
- System.out.println("3. Show Instructor Payments Due");
- System.out.println("4. Print TimeTable for Instructor");
- System.out.println("5. Show Ordered TimeTable with Codes");
- System.out.println("6. Exit");
- int choice = kb.nextInt();
- kb.nextLine();
- switch (choice) {
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- break;
- case 5:
- break;
- case 6:
- exit = true;
- break;
- }
- System.out.println("\nPress Return to continue");
- kb.nextLine();
- }
- }
- private static void printTitle(String name) {
- System.out.println("The Goto Gym " + name );
- System.out.println("-------------------------\n");
- }
- /**
- *
- * @param p,
- * prompt
- * @return a non-empty string
- */
- public static String readString(String p) {
- String r;
- do {
- System.out.print(p);
- r = kb.nextLine();
- } while (r.length() == 0);
- return r;
- }
- public static int readIntInRange(String question, int min, int max) {
- int choice = -1;
- System.out.print(question);
- boolean valid = false;
- while (!valid) {
- while (!kb.hasNextInt()) {
- kb.nextLine();
- System.out.println("ERROR - must be integer");
- System.out.println(question);
- }
- choice = kb.nextInt();
- kb.nextLine();
- if (choice >= min && choice <= max) {
- valid = true;
- }
- }
- return choice;
- }
- /**
- * Reads an integer value from the console window
- *
- * @param question,
- * question to be asked of the user
- * @return An integer value is returned.
- */
- public static int readInt(String question) {
- int choice;
- System.out.print(question);
- while (!kb.hasNextInt()) {
- kb.nextLine();
- System.out.println("ERROR - must be integer");
- System.out.println(question);
- }
- choice = kb.nextInt();
- kb.nextLine();
- return choice;
- }
- /**
- * Reads an integer value from the console window
- *
- * @param question,
- * question to be asked of the user
- * @return An integer value is returned.
- */
- public static double readDouble(String question) {
- double choice;
- System.out.print(question);
- while (!kb.hasNextDouble()) {
- kb.nextLine();
- System.out.println("ERROR - must be number");
- System.out.println(question);
- }
- choice = kb.nextDouble();
- kb.nextLine();
- return choice;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement