Hantuhafiz007

Honorable
Feb 28, 2013
5
0
10,510
;) import java.io.*;
public class bro
{
public static void main(string args[])
{
seat [][]
seats=new seat[5][6];
int row, input, how many, count =0;
string name;
string movie="Movie Title:"
+"\n1:Seat"
+"\n2:view seat"
+"\n0:quit";
for (int i=0; i<5; i++)
{
seats[0]=new Seat("1");
seats[1]=new Seat("2");
seats[2]=new Seat("3");
seats[3]=new Seat("4");
seats[4]=new Seat("5");
seats[5]=new Seat("6");
}
{
System.out.println("\n"+movie);
System.out.println("Input (1-2 or 0): ");
input = Integer.parseInt(reader.next());
reader.nextLine();
switch(input)
{
case 1:

if(count == 30)
{
System.out.println("\nThe cinema is fully booked.");
}
else
{
do
{
System.out.print("How many seats would you like to book? ");

howmany = reader.nextInt();
if(howmany>5)
{
System.out.println("The maximum number of seats per booking is 5.");
}
if(howmany<1)
{
System.out.println("The minimum number of seats per booking is 1.");
}
}
while(howmany>5 // howmany<1);
for(int j=0;j<=howmany;j++)
{
printArray(seats);
do
{
System.out.println("Where would person number"+(j+1)+" like to sit?");
do
{
System.out.print("Row: ");
row=reader.nextInt();
//If the user choses a nonexistent row
if(row>5)
{
System.out.println("There are only 5 rows, please choose a new row.");
}
}
while(row>5);
do
{
System.out.print("Seat: ");
name=reader.next();
if(!name.equals("1") && !name.equals("2") && !name.equals("3") && !name.equals("4") && !name.equals("5") && !name.equals("6"))
{
System.out.println("There are only 6 seats per row, please choose a new seat.");
}
}
while(!name.equals("1") && !name.equals("2") && !name.equals("3") &&
!name.equals("4") && !name.equals("5") && !name.equals("6"));
}
while(row>5);
for(int i=0;i<6;i++)
{
if(seats[row-1].getName().equalsIgnoreCase(name))
{
if(seats[row-1].getVisible()==false)
{
System.out.println("\nThat seat is already taken, please select another one.\n");
j--;
}

{
seats[row-1].setVisible(false);
count++;
}
}
}
}
}
break;

case 2:
printArray(seats);
break;

case 0:
System.out.println("Good bye!");
break;

default:
//Informs the user that the input is not valid
System.out.println("Invalid input.");
break;
}
}
while(input != 0);
}
public static void printArray(Seat[][] a)
{
//Prints the rows
System.out.println("-SCREEN-");
for(int i=0;i<5;i++)
{
System.out.print(i+1+" ");
//Prints the seats
for(int j=0;j<6;j++)
{
System.out.print(a[j]);
}
System.out.print(" ");
System.out.println();
}
}
}


need help on this java coding...
 

Hantuhafiz007

Honorable
Feb 28, 2013
5
0
10,510



I need to creat a simple java program that is cinema purchasing system.
Movie title, date, time, cinema no. And seat no. Need to be print on the ticket.
This program only need to use appropriate variables, control structure and array.
And the program can be test using assertion.

Can you solve it?
I have creat a java program, can you help me repair the program?
 

Hantuhafiz007

Honorable
Feb 28, 2013
5
0
10,510


Can you show me how to fix this problem?
Cause im still new on this java program..
 

Hantuhafiz007

Honorable
Feb 28, 2013
5
0
10,510



I have compile my program, but the program got an error..
I don't know how to fixed this error.
The result that I expect is just like cinema purchasing system.
 

randomizer

Distinguished
We can't read your mind or your screen. You're going to have to tell us the error and maybe even post a stacktrace (if it's a runtime error). The more details that you can tell us about the problem and what you are trying to do, the better. If you are vague you are going to get vague answers.
 

Hantuhafiz007

Honorable
Feb 28, 2013
5
0
10,510



I have fix the spaces at "howmany".
But when i run, "while(howmany>5 // howmany<1); "
Have an error..
Can you find why?
Please..