FlightReservations

FlightReservations - System.out.println("2. Reserve...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
public class FlightReservations { public static void main(String[] args) { final String noPassenger = "no passenger"; System.out.print("Enter the number of rows on the plane: "); int numRows = IO.readInt(); if (numRows < 1) { System.out.println("There must be at least one row of seats on the plane."); IO.reportBadInput(); return; } System.out.print("Enter the number of seats in each row: "); int seatsPerRow = IO.readInt(); if (seatsPerRow < 1) { System.out.println("There must be at least one seat in each row."); IO.reportBadInput(); return; } while (true) { System.out.println(); System.out.println("Menu:"); System.out.println("1. Assign passenger to a specific seat");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println("2. Reserve (search for) one seat"); System.out.println("3. Get name of passenger assigned to a specific seat"); System.out.println("4. Get seat assignment for a passenger"); System.out.println("5. Cancel a reservation"); System.out.println("6. Quit"); System.out.println(); System.out.print("Enter your choice (1-6): "); int choice = IO.readInt(); if (choice == 1) { } else if (choice == 2) { } else if (choice == 3) { } else if (choice == 4) { } else if (choice == 5) { } else if (choice == 6) { return; } else { System.out.println("Invalid choice, please select 1 through 6."); } } } }...
View Full Document

This note was uploaded on 11/03/2009 for the course CS 01-111 taught by Professor Pradiphari during the Fall '09 term at Rutgers.

Page1 / 2

FlightReservations - System.out.println("2. Reserve...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online