PDA

View Full Version : Help with two dimensional array

Orudis
04-16-2005, 07:02 PM
I need hlep with a program that calculates prices for a movie theater based on the seating arrangement at a single movie show. I was able to set the two dimensional array but I am having trouble adding up the movie tickets seatings. There are five different types of tickets. Seat A = 5.50, Seat B = 4.00, Seat C = 6.50, Seat D = 8.50, and Seat E = 5.00. Can anyone help??? The code I have so far is:

public class TheaterSeating {
public static void main(String[] args) {

// Seating Arrangement Array
char[][] seatingArrangement = {
{'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D'},
{'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D'},
{'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D'},
{'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}};

System.out.print("Theather Seating are as follows: " + "\n");
for (int i=0; i<seatingArrangement.length; i++) {
if(i>=0) System.out.print(seatingArrangement[i]);

if (i>=0) System.out.println(" is the seating arrangement for seat " + i);

}

}
}

vwphillips
04-16-2005, 08:42 PM
If you want to do this with JavaScript I can help but if you are using Java try the Forum

Orudis
04-16-2005, 08:50 PM
yes, I am using JavaScript