Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
ı spent 2 hours yet i cant solve this question i missed a week of class becouse of illness so i am confused about the question very much please help me


Ticket Reservation System
You are a computer engineer working in the IT department of Biletix, a company of online reservation. You
are asked to develop a new application to assign seats on the Stüdyo Sahne (capacity: 12 seats). Your
application asks for the following operations:
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
The system asks to select an operation until the user selects 4 (Exit).
1 View SeatPlan: User selects 1
§ The application displays the seat plan with the rows and the seats. There are 3 rows and 4 seats per
each row.
§ Initially, all seats are empty and represented as - . If your make a reservation for a seat, then the seat
is full and represented as X. The format is as follows:

To hold the seating plan of the theater hall, use a one-dimensional array of type boolean,
seatArray.
o Initialize all the elements to false to indicate that all the seats are empty.
false false false false false false false false false false false false
• To hold the customer names, use a one-dimensional array of type String, customerArray.
o Initialize all the elements to ""(empty string) to indicate that all the costumers are empty.
• User enters row and seat number, and then the customer name.
(a) If the selected row/seat is free (check the seat was not reserved - false), the program
makes reservation by
o Setting the corresponding index on the seatArray to true.
o Recording the customer name to the corresponding index of the customerArray.
(b) If the selected row/seat is full (check the seat was reserved - true), your application prints an
info message to reserve another seat.
e.g. Assume that after 10 operations, the states of the arrays are as follows. The user selects 2 as
the 11th operation and enters “2 3” as row/seat, name “Maya” . The program checks if the 3rd seat
on the 2nd row is available. If it is available, the program makes the reservation.


Example output:
Welcome!!! Please select
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 2
1st Row (Price 100 TL)
2nd Row (Price 50 TL)
3nd Row (Price 25 TL)
Select Row & Seat: 3 1
Name: selen
Row3/Seat1 is reserved.
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 2
1st Row (Price 100 TL)
2nd Row (Price 50 TL)
3nd Row (Price 25 TL)
Select Row & Seat: 1 4
Name: elif
Row1/Seat4 is reserved.
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 1
Row1 1-- 2-- 3-- 4-X
Row2 1-- 2-- 3-- 4--
Row3 1-X 2-- 3-- 4--
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 2
1st Row (Price 100 TL)
2nd Row (Price 50 TL)
3nd Row (Price 25 TL)
Select Row & Seat: 1 2
Name: Ali
Row1/Seat2 is reserved.
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 1
Row1 1-- 2-X 3-- 4-X
Row2 1-- 2-- 3-- 4--
Row3 1-X 2-- 3-- 4--
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 3
Enter Name:ELIF
Reservation Details:
Name:ELIF
Row1/Seat4
1 View SeatPlan
2 Make Reservation
3 View Reservation
4 Exit
Operation: 4
Exit...

What I have tried:

package homelab05;
import java.util.Scanner;
public class Question {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner keyboard = new Scanner(System.in);
int i;
String whole,full="-X",empty="--";
String chair[] = new String[12];
boolean[] seating = new boolean[12];
System.out.println("Welcome!!! Please select");
System.out.println("1 View SeatPlan");
System.out.println("2 Make Reservation");
System.out.println("3 View Reservation");
System.out.println("4 Exit");
System.out.println("Operation: ");
System.out.println("Row1 1"+chair[1]+"2-- 3-- 4--");



}


public String methodName(boolean b)
{
boolean[] seating = new boolean[12];
String chair[] = new String[12];
int i=0;
String full="-X",empty="--",str="";
seating[1]=true;
if(seating[1]==true)
{
chair[1]=full;

}return chair[1];
}

//System.out.println("Row2 1-- 2-- 3-- 4--");
//System.out.println("Row3 1-- 2-- 3-- 4--");

}
Posted
Updated 6-May-18 5:42am

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
You can go to The Java™ Tutorials[^] to learn some of the things you missed. Or, better still, go and talk to your teacher and ask for the missing notes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900