Java Programming

profileSagat
InstructionsforProjectTwoTheaterSeating.pdf

Copyright © 2022, Dallas College. All Rights reserved. Page 1 of 3

Project Two, Theater Seating You have been hired to write a program that manages reserved seating for a small off-Broadway theater. There are six rows in the theater. Each row contains eight seats. The rows in the theater are identified by the letters A through F starting from the front of the theater. The seats within each row are identified by the numbers 1 through 8. Reservation information is to be stored in a two-dimensional integer array. The value one (1) will be used to indicate that a seat has been reserved. The value zero (0) will be used to indicate that a seat has not been reserved. The array should be initialized to zeroes before presenting the following menu to the user the first time.

Your program will repeatedly present the user with the following choices:

Option Action ------ -------------- 1 Clear all reservations. 2 Read reservations from a file. 3 Make a reservation. 4 Save seating chart to a file. 5 Quit. Enter your choice:

When the user selects option 1, your program will assign the value zero (0) to all the elements in the array.

When the user selects option 2, your program will ask the user to identify a file, open and read the file, and use the records in the file to store reserved seating information. The file will be a text file that contains six records, one for each of the six rows in the theater. Each record will contain eight integer values, one for each seat in that row. The values will be separated from each other by one or more blanks. A typical record looks like this:

0 1 1 0 0 1 1 0

After opening, reading, and processing the file, your program will display a message indicating how many seats have been reserved as a result of that processing. That message should look something like this:

24 reserved seats have been loaded.

When the user selects option 3, your program will accept a single line of keyboard input from the user in the form of a letter identifying the desired row and the desired seat number in that row separated from the row letter by a blank. For example, when the user wants to indicate that a reservation should be made for seats 6 and 7 in row D, they will enter:

D 6 D 7

Copyright © 2022, Dallas College. All Rights reserved. Page 2 of 3

Your program will do the following:

• Validate the user’s input. Valid rows are letters from A through F, either upper-case (A, B, C, D, E, F) or lower-case (a, b, c, d, e, f). Valid seat numbers range from 1 through 8. If the user inadvertently enters an invalid seat identification, inform them, and allow them to make a correct entry. (Hint: Refer to section 4.3 of our textbook, entitled “Using the while Loop for Input Validation”.)

• If the user enters a valid seat identification, determine if that seat has already been reserved. If it has, inform the user, and display the main menu again, allowing them to reserve a different seat. Otherwise, mark that seat as reserved.

When the user selects option 4, your program will ask the user to enter a month and day string that identifies this set of reservations. The program will then create a seating diagram and write it to a text file named Seating.txt. Your program will display a brief summary to the screen repeating the reservation date that was entered by the user and showing the total number of seats reserved for that date. A typical screen report would look like this after the user indicates that this set of reservations is for February 23:

42 seats reserved for February 23

The seating chart will display reserved seats as the value 1, seats that have not been reserved will be displayed as a 0. The report will include the total number of seats that have been reserved for each row as well as the total of seats reserved for that date. A typical seating report looks like this:

Seating Chart for February 23

Prepared: Sat Jan 29 08:05:30 CST 2022

Row ------------------------ Total A 0 0 0 1 1 0 1 0 3 B 0 0 0 1 1 0 1 0 3 C 0 0 0 1 1 0 1 0 3 D 0 0 1 1 1 1 1 0 5 E 0 1 0 1 1 1 1 0 5 F 1 0 0 1 1 0 1 1 5

24 seats reserved for February 23

When the user selects option 5, the program will terminate.

Start early. Test your program. Your instructor will run your program to help determine your grade for this assignment.

Copyright © 2022, Dallas College. All Rights reserved. Page 3 of 3

To receive full credit for this programming assignment, you must:

• Use the correct file name. For example, a student named John Jones will name his file, “JJProjectTwo.java”.

• Submit a program that executes correctly. (No syntax or execution errors) Grading Guideline:

• Correctly name the file that is submitted. (5 points) • Include a comment containing the student’s full name in the program. (5

points) • Store the reserved seating information in an integer two-dimensional array

that has the appropriate number of rows and columns. (10 points) • Repeatedly display the specified menu choices. (10 points) • Validate the menu choice entered by the user. (5 points) • Correctly reads and processes a user specified file as part of menu choice 2.

(10 points) • Reports the number of seats reserved as a result of processing a file. (5

points) • Validates the row and seat number entered as part of menu choice 3. (10

points) • Correctly determines if a seat has already been reserved as part of menu

choice 3. (5 points) • Prompts the user for a reservation date string as part of menu choice 4. (5

points) • Writes seating chart information correctly to a file named Seating.txt (10

points) • Output file contains correct row totals and an overall total. (10 points) • Output contains the current date and time. (5 points) • Program terminates when option 5 is selected. (-5 points)

  • Project Two, Theater Seating