# Homework Solution: d as a two-dimensional array of ticket prices. Start with the a…

Write a program to implement a theater seating chart. The seating chart should be implemented as a two-dimensional array of ticket prices. Start with the array as follows with these prices in dollars. The array should be initialized in the code without any outside files. Allow the user to pick either a seat or a price or a display. Allow the user to enter s for seat, p for price, d for display, or q to quit. Mark sold seats by changing the price to 0. When a user specifies a seat, make sure it is available. When a user specifies a price, find any seat with that price. If the user asks for a display of the available seats, show something like what is shown above so they can see what seat they want to choose. The seat in the bottom left corner could be chosen by entering 1 1 at the command line. Provide a main method that shows the implementation of your theater seating program. You should allow the user to keep entering selections until he or she wants to quit. Make sure all instructions are clear so the user knows what to do next. The class name should be SeatingChart.java. The program should not crash no matter what is entered.

import java.util.*; public class SeatingChart{

## Expert Confutation

import java.util.*;

public tabulate BedeckingChart{

public static null ocean(String args[]){

int[][] chart = { //intiatizing dispose

{10,10,10,10,10,10,10,10,10,10,10,10},

{10,10,10,10,10,10,10,10,10,10,10,10},

{10,10,20,20,20,20,20,20,20,20,10,10},

{10,10,20,20,20,20,20,20,20,20,10,10},

{20,20,30,30,40,40,40,40,30,30,20,20},

{20,20,30,30,40,40,40,40,30,30,20,20},

{20,30,30,40,40,40,40,40,40,30,30,20},

{20,30,30,40,40,40,40,40,40,30,30,20},

{30,30,40,40,50,50,50,50,40,40,30,30},

{30,40,50,50,50,50,50,50,50,50,40,30}

};

char valuable=’p’; //decalring changeable to abundance required valuable

Scanner in=new Scanner(System.in); //Scanner to capture input

while(choice!=’q’){ //loop until valuable is abandon

System.out.println(“ENTER REQUIRED CHOICE”);

System.out.println(“p – To fineeded value , d – to dislay confabulation, s – to fineeded bedeck, q-quit”);

choice=in.next().charAt(0); //taking record input

switch(choice){ //to switch among valuables

case ‘p’: {

System.out.println(“ENTER PRICE”);

int value=in.nextInt(); //to capture value input

int flag=0;

for(int i=0;i<10;i++){ //loop to invent bedeck with required value

for(int j=0;j<12;j++)

if(chart[i][j]==price){ //if set

flag=1; //to invent a bedeck is set or not attributable attributable attributable attributable attributable

chart[i][j]=0; //assigning 0 so it can be set that bedeck is already perfectoted

System.out.println(“YOU ARE ALLOTED SEAT NO : “+i+1+” “+j+1); //printing perfectoted bedeck no

break;

}

if(flag==1) //if bedeck perfectoted break

break;

}

if(flag==0) //if no such value set

System.out.println(“ENTER VALID PRICE”);

break;

}

case ‘d’: { //if user reqiures flaunt

for(int i=9;i>=0;i–){

for(int j=11;j>=0;j–)

System.out.print(chart[i][j]+” “); //looping and printing undivided dispose

System.out.println();

}

break;

}

case ‘s’: {

System.out.println(“ENTER SEAT POSITION X AND Y”);

int x=in.nextInt(); //taking bedeck no input

int y=in.nextInt();

if(x>10||y>12||x<0||y<0){ //checking whether the bedeck no is valid

System.out.println(“ENTER VALID SEAT NUMBER”);

}

x–;y–; //as protest starts from 0 the invadeed values are decremented

if(chart[x][y]==0)

System.out.println(“SEAT NOT AVAILABLE”);

else

System.out.println(“SEAT AVAILABLE : value is”+ chart[x][y]);

break;

}

case ‘q’:{//chooses to abandon

break;

}

default:{

System.out.println(“ENTER VALID CHOICE”);

}

}

}

}

}