PROGRAMMING ASSIGNMENT: AIRLINE RESERVATION PROGRAM A ir Canada is looking to upgrade their airline reservation program and is looking for a programmer who could design a new program for them. The purpose of the program is to allow their employees to book seats for customers who are flying with Air Canada. Your program must meet the following requirements: When the program launches, a seating chart should be outputted that is comprised of 10 rows and 8 columns representing the seats that are available on a plane. Airline Reservation Program Page 1 of 14 ASSIGNING A SEAT A seat can be assigned to a customer by simply clicking on any of the buttons. When a button is clicked, the user should be prompted to enter the user’s first name and last name in two input dialogs. Once the user has entered the customer’s first and last name, a message dialog should be outputted confirming that the user has been assigned to the seat that was selected and the button should be labeled with an ‘X’ and the background colour should be set to red. Airline Reservation Program Page 2 of 14 If the user selects a seat that has already been reserved, a confirm dialog should be outputted asking the user if they want to remove the person assigned to that seat. If the user selects YES, then the passenger should be removed from that seat and the seat should become available again if there is nobody on the waiting list. If the passenger is removed from their assigned seat and there are passengers on the waiting list, the first passenger on the waiting list must be assigned to the seat that has become available and a message should be outputted confirming that the passenger has been assigned to that seat. Airline Reservation Program Page 3 of 14 If the user selects NO, then nothing should happen. VIEWING THE MANIFEST A flight manifest is a list of passengers of an aircraft that is compiled before a flight departs. When the user clicks the VIEW MANIFEST button, a list of all the passengers that have a seat reserved should be outputted in the order that they are stored in your LinkedList. From here, the user has the option to sort the list of passengers by NAME or by their SEAT NUMBER. Airline Reservation Program Page 4 of 14 Sorted by NAME Sorted by SEAT When the user clicks the CLOSE button, the user should be returned to the main screen. ADDING PASSENGERS TO THE WAITING LIST If there are no seats remaining on the plane, passengers can be added to a waiting list. When users click on VIEW WAITING LIST, the following window should appear: Airline Reservation Program Page 5 of 14 When users click the ADD button, the user should be prompted to add the customer’s first and last name. Once the customer’s information has been added, a message should be outputted confirming that the passenger has been added and their name should appear on the list as well as where they are in the queue. Airline Reservation Program Page 6 of 14 If there are seats remaining and the customer tries adding someone to the waiting list, the following message should be outputted and the user should be prevented from adding someone to the waiting list: REMOVING PASSENGERS FROM THE WAITING LIST To remove passengers from the waiting list, you will simply need to click on a customer’s name and then select the REMOVE button. For this you will need to use a JList and DefaultListModel object (which will be provided). When the user selects REMOVE, a confirm dialog should appear asking the user if they are sure they want to remove the customer: Airline Reservation Program Page 7 of 14 MOVING PEOPLE UP OR DOWN THE WAITING LIST Users have the option to move people up or down the waiting list. When the user selects a person and clicks the UP button, the person should move up one spot in the queue, swapping positions with the person ahead of them. When the user selects a person and clicks the DOWN button, the person should move down one spot in the queue, swapping positions with the person behind them. In the following example, I have moved Emilee Santistevan up the queue by having her swap her place in line with Vonda Lu. SAVING TO A FILE The user will have the option to save the list of passengers who have been assigned a seat and the list of people on the waiting list to a text file. When the user clicks File > Save from the menu bar, a JFileChooser object should appear prompting the user to select where they want to save the file and what they want to call the file: Airline Reservation Program Page 8 of 14 Once the user clicks SAVE, the data from should be written as follows: The first line in the text file should be the number of passengers who have been assigned a seat. The second line of code should be the number of people who are on the waiting list. This should be followed by the list of all the passengers who have been assigned a seat written in comma-delimited format whereby you have the first name of the passenger, followed by the last name, the row number, and the aisle. If there are people on the waiting list, they should be listed right after the last passenger on the list, also written in comma-delimited format (first name, last name, and a number indicating where they stand on the list). OPENING A FILE The user will also have the option to open a file so that they can continue working from a previously saved file of passengers and people on a waiting list. When the user clicks File > Open from the menu bar, a JFileChooser object should appear prompting the user to select a file: Airline Reservation Program Page 9 of 14 Once the manifest is opened, the seats should be assigned to the passengers according to the information in the file. Airline Reservation Program Page 10 of 14 For this assignment, it would be a good idea to create a Passenger class and a Seat class. The Passenger class would look something like this: Passenger implements Comparable<Passenger> + + + firstName, lastName, seatNumber, aisle, name: String rowNumber: int SORT_BY_NAME: int SORT_BY_SEAT: int sortValue: int Passenger() Passenger(first: String, last: String) Passenger(first: String, last: String, row: int, aisle: String) + compareTo(p: Passenger): int + getAisle(): String + getFirstName(): String Airline Reservation Program Page 11 of 14 + + + + + + + + + + + getLastName(): String getName(): String getRowNumber(): int getSeatNumber(): String setAisle(letter: String) setFirstName(first: String) setLastName(last: String) setName(first: String, last: String): void setRowNumber(num: int) setSeatNumber(seatNumber: String): void toString(): String The Seat class would look something like this: Seat extends JButton - row: int - aisle, seat, firstName, lastName: String - occupied: boolean Seat() Seat(rowNumber: int, aisle: String) + + + + + + + addPassenger(first: String, last: String) getAisle(): String getName(): String getRowNumber(): int getSeat(): String hasPassenger(): boolean removePassenger(): void Save the project as Airline Reservation in your COMPLETED ASSIGNMENTS folder. Airline Reservation Program Page 12 of 14 PROGRAMMING ASSIGNMENT: AIRLINE RESERVATION PROGRAM NAME: ________________________ CATEGORY Knowledge and Understanding TOTAL: LEVEL 3 70 – 79% / 40 CRITERIA < LEVEL 1 0 – 49% LEVEL 1 50 – 59% LEVEL 2 60 – 69% LEVEL 4 80 – 100% Demonstrates an understanding of how to create a program that reads from and writes to a file Demonstrates no understanding of how to read from and write to a file Demonstrates limited understanding of how to read from and write to a file Demonstrates some understanding of how to read from and write to a file Demonstrates considerable understanding of how to read from and write to a file Demonstrates thorough understanding of how to read from and write to a file Demonstrates an understanding of how to use the LinkedList class to store and retrieve information Demonstrates no understanding of how to use the LinkedList class Demonstrates limited understanding of how to use the LinkedList class Demonstrates some understanding of how to use the LinkedList class Demonstrates considerable understanding of how to use the LinkedList class Demonstrates thorough understanding of how to use the LinkedList class 0-4.9 5.0-5.9 The program meets all the specifications required Program meets none of the required specifications Program meets a limited number of the required specifications Validates program to ensure the program produces correct results Validates program with no success Validates program with limited success MARK /10 6.0-6.9 Thinking 0-4.9 Communication Provides internal documentation that clearly explains the methods and the program logic Documents program logic with no success 5.0-5.9 Documents program logic with limited success 7.0-7.9 8.0-10.0 Program meets some of the required specifications Program meets most of the required specifications Program meets all of the required specifications Validates program with some success Validates program with considerable success Validates program with great success 6.0-6.9 Documents program logic with some success 7.0-7.9 Documents program logic with considerable success /10 8.0-10.0 Documents program logic with great success /10 0-4.9 Effectively applies programming skills and knowledge of Java to create a program using the java.io package and LinkedList class Application 5.0-5.9 6.0-6.9 7.0-7.9 8.0-10.0 Applies programming knowledge and skills with no success Applies programming knowledge and skills with limited success Applies programming knowledge and skills with some success Applies programming knowledge and skills with considerable success Applies programming knowledge and skills with great success 0-4.9 5.0-5.9 6.0-6.9 7.0-7.9 8.0-10.0 OVERALL CURRICULUM EXPECTATIONS THAT ARE COVERED IN THIS ASSIGNMENT: A1. A2. A3. A4. B1. B2. C1. Demonstrate the ability to use different data types and expressions when creating computer programs. Describe and use modular programming concepts and principles in the creation of computer programs. Design and write algorithms and subprograms to solve a variety of problems. Use proper code maintenance techniques when creating computer programs. Demonstrate the ability to manage the software development process effectively, through all of its stages – planning, development, production, and closing. Apply standard project management techniques in the context of a student-managed team project. Demonstrate the ability to apply modular design concepts in computer programs. Airline Reservation Program Page 13 of 14 /10 CATHOLIC GRADUATE EXPECTATIONS THAT ARE COVERED IN THIS ASSIGNMENT: Presents information and ideas clearly and honestly and with sensitivity to others. Uses and integrates the Catholic faith tradition, in the critical analysis of the arts, media, technology and information systems to enhance the quality of life. Creates, adapts, and evaluates new ideas in light of the common good. Demonstrates flexibility and adaptability. Thinks reflectively and creatively to evaluate situations and solve problems. Sets appropriate goals and priorities in school, work and personal life. Achieves excellence, originality, and integrity in one's own work and supports these qualities in the work of others. Airline Reservation Program Page 14 of 14