I have these 2 classes:
import javax.swing.JOptionPane;
public class Theatre2D {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// declares an array of integers
int[][] myTheatre2D;
// allocates memory for 2*10 integers
myTheatre2D = new int[2][10];
myTheatre2D[0][0] = 20;
myTheatre2D[0][1] = 30;
myTheatre2D[0][2] = 40;
myTheatre2D[0][3] = 50;
myTheatre2D[0][4] = 60;
myTheatre2D[0][5] = 60;
myTheatre2D[0][6] = 50;
myTheatre2D[0][7] = 40;
myTheatre2D[0][8] = 30;
myTheatre2D[0][9] = 20;
//Start Second Row
myTheatre2D[1][0] = 20;
myTheatre2D[1][1] = 30;
myTheatre2D[1][2] = 40;
myTheatre2D[1][3] = 50;
myTheatre2D[1][4] = 60;
myTheatre2D[1][5] = 60;
myTheatre2D[1][6] = 50;
myTheatre2D[1][7] = 40;
myTheatre2D[1][8] = 30;
myTheatre2D[1][9] = 20;
String[][] seatStatus = new String[2][10];
seatStatus[0][0] = "Open";
seatStatus[0][1] = "Open";
seatStatus[0][2] = "Open";
seatStatus[0][3] = "Open";
seatStatus[0][4] = "Open";
seatStatus[0][5] = "Open";
seatStatus[0][6] = "Open";
seatStatus[0][7] = "Open";
seatStatus[0][8] = "Open";
seatStatus[0][9] = "Open";
//Second row
seatStatus[1][0] = "Open";
seatStatus[1][1] = "Open";
seatStatus[1][2] = "Open";
seatStatus[1][3] = "Open";
seatStatus[1][4] = "Open";
seatStatus[1][5] = "Open";
seatStatus[1][6] = "Open";
seatStatus[1][7] = "Open";
seatStatus[1][8] = "Open";
seatStatus[1][9] = "Open";
int column = 0;
int row = 0;
while (row<2){
while (column<10){
System.out.println("Row "+(row+1)+", seat " + (column+1)+" costs "
+myTheatre2D[row][column] +" dollars."
+ "That seat is currently " + seatStatus[row][column]);
column+=1;
}
row+=1;
column = 0;
}
for (int s=0;s<20;s++){
String crow = JOptionPane.showInputDialog("From which row do you wish to purchase? (1-2) ");
int crownum = Integer.parseInt(crow);
String cseat = JOptionPane.showInputDialog("From row " + crow+ " which seat do you wish to purchase? (1-10)");
int cseatnum = Integer.parseInt(cseat);
if (seatStatus[crownum-1][cseatnum-1]=="Open");
seatStatus[crownum-1][cseatnum-1] = "Occupied";
System.out.println("");
System.out.println("Thanks for you purchase! It has cost you $"+myTheatre2D[crownum-1][cseatnum-1]+".");
System.out.println("");
myTheatre.PrintSeats();
}
}
}
and
public class Seating2D {
public void PrintSeats() {
int[][] seats = new int[10][5];
int column = 0;
int row = 0;
while (row<5){
while (column<10){
System.out.println(seats[column][row]);
column+=1;
}
row+=1;
column = 0;
}
}
}
I am having trouble making the main class use the PrintSeats module.Any help is appreciated.
Thanks,
Jaro