Problem in java

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...
 
You haven't asked a question. You haven't told is what the program is supposed to do. You haven't told us what error(s) there are. How can we help you?
 



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?
 
I see your program, but you haven't told us what is wrong.

Does it compile?
What input are you giving it?
What results do you expect?
What results are you getting?

You still haven't told us what your problem is.
 


Can you show me how to fix this problem?
Cause im still new on this java program..
 
You take out the space in "how many".

As you still haven't told us what your problem is, what is going wrong, whether your program compiles, or much else, I'm going to give up at this point.
 



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.
 
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.
 



I have fix the spaces at "howmany".
But when i run, "while(howmany>5 // howmany<1); "
Have an error..
Can you find why?
Please..
 
This looks suspiciously like a homework assignment, and the OP is hoping we'll do all the grunt work for him/her.
 
It quite likely is given the relatively small amount of code. However, since we still haven't been told the actual error it's very difficult to do the grunt work anyway.