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. 30 40 50 50 50 50 50 50 50 50 40 30 30 30 40 40 50 50 50 50 40 40 30 30 20 30 30 40 40 40 40 40 40 30 30 20 20 30 30 40 40 40 40 40 40 30 30 20 20 20 30 30 40 40 40 40 30 30 20 20 20 20 30 30 40 40 40 40 30 30 20 20 10 10 20 20 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 20 20 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 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 O. 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 showrn 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
    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.

    Expert Answer

     
    import java.util.*; public class SeatingChart{

    Write a program to appliance a theater bedecking chart. The bedecking chart should be applianceed as a two-dimensional dispose of ticket values. Start with the dispose as follows with these values in dollars. The dispose should be initialized in the legislation extraneously any extraneously files. 30 40 50 50 50 50 50 50 50 50 40 30 30 30 40 40 50 50 50 50 40 40 30 30 20 30 30 40 40 40 40 40 40 30 30 20 20 30 30 40 40 40 40 40 40 30 30 20 20 20 30 30 40 40 40 40 30 30 20 20 20 20 30 30 40 40 40 40 30 30 20 20 10 10 20 20 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 20 20 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 Confess the user to pluck either a bedeck or a value or a flaunt. Confess the user to invade s control bedeck, p control value, d control flaunt, or q to abandon. Mark sold bedecks by changing the value to O. When a user specifies a bedeck, controlm abiding it is adapted. When a user specifies a value, invent any bedeck with that value. If the user asks control a flaunt of the adapted bedecks, parade triton love what is paradern aloft so they can beware what bedeck they absence to elect. The bedeck in the deep left retreat could be fineeded by invadeing 1 1 at the bid cord. Provide a ocean course that parades the applianceation of your theater bedecking program. You should confess the user to continue invadeing fineedions until he or she absences to abandon. Controlm abiding perfect instructions are disentangled so the user knows what to do direct. The tabulate ctotal should be BedeckingChart.java. The program should not attributable attributable attributable attributable attributable attributable resonance no substance what is invadeed

    Write a program to appliance a theater bedecking chart. The bedecking chart should be applianceed as a two-dimensional dispose of ticket values. Start with the dispose as follows with these values in dollars. The dispose should be initialized in the legislation extraneously any extraneously files. Confess the user to pluck either a bedeck or a value or a flaunt. Confess the user to invade s control bedeck, p control value, d control flaunt, or q to abandon. Mark sold bedecks by changing the value to 0. When a user specifies a bedeck, controlm abiding it is adapted. When a user specifies a value, invent any bedeck with that value. If the user asks control a flaunt of the adapted bedecks, parade triton love what is paraden aloft so they can beware what bedeck they absence to elect. The bedeck in the deep left retreat could be fineeded by invadeing 1 1 at the bid cord. Provide a ocean course that parades the applianceation of your theater bedecking program. You should confess the user to continue invadeing fineedions until he or she absences to abandon. Controlm abiding perfect instructions are disentangled so the user knows what to do direct. The tabulate ctotal should be BedeckingChart.java. The program should not attributable attributable attributable attributable attributable attributable resonance no substance what is invadeed.

    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”);

    }

    }

    }

    }

    }