aspose file tools*
The moose likes Beginning Java and the fly likes Im having problems with writing this program :( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Im having problems with writing this program :(" Watch "Im having problems with writing this program :(" New topic
Author

Im having problems with writing this program :(

C Ho
Greenhorn

Joined: Dec 15, 2002
Posts: 16
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

Joined: Nov 28, 2001
Posts: 233
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


Sharing is learning
Mellihoney Michael
Ranch Hand

Joined: Nov 27, 2002
Posts: 124
that works!
speed up


a beginner in java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Im having problems with writing this program :(