• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Im having problems with writing this program :(

 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OBJECTIVE: You are asked to write a "reservation system" program for the school play. The auditorium's seating plan has 15 rows labelled 'A' to 'O' and 10 aisles labelled 1 to 10. The array (seating plan) will store only 2 possible boolean values, false if the seat is unsold and true if it is sold. Your program will allow the uesr to enter in any number of sold tickets (seats in the seating plan). Stop your program with a "Do you with to stop y/n?". After you have stopped entering in the sold seats print out your seating plan. So that you can print out the seating plan on one page of output, if the seat is sold print 's' otherwise print 'u'. Test your program with the following data.
Seats Sold 1. row 'A' , aisle 1
2. row 'O' , aisle 10
3. row 'A' , aisle 10
4. row 'O' , aisle 1
5. stop

I dont really get what to do, and what to start off doing. I am a beginner at Java (first year learning it at school) and I've only learned some of the basics. Right now, Im in the third chapter at school (Arrays and Multidimensional arrays). Ive only learned real basic java and loops in the previous chapters. If anyone can lead me in the right direction of how to get this program to work, it would be greatly appreciated..... Thanks!!
The first problem I have is how to make a multidimensional array with the ROWS being Char ('a' to 'o') and COLUMNS being Num (1 to 10)... That is the first problem I have and I dont know what to do
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
To start your program here is a sample to create the multi dim array.
public class MultiArray
{
public static void main( String args[] )
{
String mArray[][] = new String[15][10];
// to populate the array
for(int i=65,j=0; i<80; i++, j++)
{
for(int m=1,n=0 ; m<=10 ; m++, n++)
{
mArray[j][n]=(char)i + String.valueOf(m);
}
}
//to print the array.
for(int i=0; i<15; i++)
{
for(int j=0;j<10;j++)
{
System.out.print( " "+ mArray[i][j]);
}
System.out.println();
}
}
}
-arun
 
Mellihoney Michael
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that works!
speed up
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic