0% found this document useful (0 votes)
30 views2 pages

Week5 MachineProblem1 09062021

The document provides instructions for a programming assignment to create a seat reservation system using a 2D array in Java. Students are asked to write a program that allows a user to input a seat number, reserves that seat by replacing it with an X in the 2D array display, and provides feedback on the reservation or any errors. The program should continuously loop to allow multiple reservations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Week5 MachineProblem1 09062021

The document provides instructions for a programming assignment to create a seat reservation system using a 2D array in Java. Students are asked to write a program that allows a user to input a seat number, reserves that seat by replacing it with an X in the 2D array display, and provides feedback on the reservation or any errors. The program should continuously loop to allow multiple reservations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Programming 2

Machine Problem 1
1

Week005 – Machine Problem 1

Objective/s:
At the end of this activity, you should be able to:
 Write a Java program that makes use of two-dimensional array.
 Use if-else or switch-case statements.
 Apply the corresponding looping statement.

What to Prepare for the Activity:


 NetBeans IDE 8.2 or the latest version
 JDK8 (Java Development Kit 8) or the latest version

Procedure:
 Create a NetBeans project for this activity.
Project Name: MP1_<lastname_firstname>
Example: MP1_Blanco_Maria
 The class name should be SeatReservation_<lastname>.
Example: SeatReservation_Blanco
 Compress the NetBeans project into .rar or .zip format and then upload to
the link provided in the LMS.
 Only NetBeans project will be accepted. Non-compliance will require
resubmission. The highest score for resubmission is 50%.

Program Specification:
1. Use two-dimensional array with size 7 columns and 5 rows.
2. Seat numbers are populated during run-time and not hard-coded.
3. User is asked to input a seat number.
4. The chosen seat number is replaced by the letter X.
5. Program displays a remark “Seat successfully reserved” when reservation is
done.

Assessments
6. The user is not allowed to reserve a previously reserved seat. Display “Seat is
taken” remarks.
7. The user is not allowed to enter an invalid seat number. Display an error
message.
8. The program continuously loops.

Sample Output:
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35

Enter seat number to reserve: 11

1 2 3 4 5 6 7
8 9 10 X 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35

Enter seat number to reserve:

You might also like