Example #1
0
  public static void updateGuest() throws IOException, Exception {
    System.out.println("Enter the guest ID: ");
    String id = bufferRead.readLine();

    System.out.println("Enter the guest's full name, or press enter to skip: ");
    String name = bufferRead.readLine().trim();

    while (!Guest.isNameLengthValid(name)) {
      System.out.println("Invalid: Please enter a name that is " + "less than 30 characters: ");
      name = bufferRead.readLine();
    }

    if (name.length() == 0) {
      name = null;
    }

    System.out.println("Please enter the guest's address, or press enter to skip: ");
    String address = bufferRead.readLine();

    if (address.length() == 0) {
      address = null;
    }

    // call add guest
    Guest.update(conn, id, name, address);
  }
Example #2
0
  public static void deleteGuest() throws IOException, Exception {
    System.out.println("Enter the guest ID: ");
    String id = bufferRead.readLine();

    // call delete guest
    Guest.delete(conn, id);
  }
Example #3
0
  public static void addGuest() throws IOException, Exception {
    // Get guestname, address
    System.out.println("Enter the guest's full name:");
    String name = bufferRead.readLine();

    while (!Guest.isNameValid(name)) {
      System.out.println(
          "Invalid: Please enter a non-empty value that is " + "less than 30 characters: ");
      name = bufferRead.readLine();
    }

    System.out.println("Enter the guest's address");
    String address = bufferRead.readLine();

    // call add guest
    Guest.add(conn, name, address);

    return;
  }