473,513 Members | 2,339 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SEATING CHART java program help?

10 New Member
I need to write a program that goes through a seating chart row by row and find n consecutive seats in a row. If the seating charts has seats available, it must print out the message saying in what row and what seats. If there are no seats available, it must return the message: "There's no group of seats to satisfy your request." It must also print out the seating chart I need help on how to find the n consecutive seats and find the row and number of the seats. Here's what I have so far:"

Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  2.  
  3. public class TheaterSeating
  4. {
  5.   public static void main( String args[] )
  6.   {
  7.     int[][] grid;    // declare 2D array reference variable
  8.     int M = 12;
  9.     int N = 12;
  10.     int K = 4;
  11.  
  12.     grid = new int[M][N]; // create 2D array
  13.     for (int i = 0; i<N; i++)
  14.     {
  15.       for (int j = 0; j< M; j++)
  16.       {
  17.         grid [i][j] = (int)(2*Math.random());
  18.       }
  19.     }    
  20.    System.out.println("The current seating chart is:");
  21.     printSeats(grid, M, N);
  22.   }
  23.  
  24.   public static void printSeats(int seat[][], int N, int M)
  25.   {
  26.     for (int i = 0; i<N; i++)
  27.       {
  28.         for (int j = 0; j< M; j++)
  29.         {
  30.  
  31.           System.out.print(seat[i][j]);
  32.         }
  33.         System.out.println("");
  34.       }
  35.     }
  36.  
  37. }
Mar 8 '08 #1
0 1754

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2440
by: Rui Pacheco | last post by:
Hi everyone I'm trying to create a chart with 2 Y axis and 1 X axis, but I can't seem to find the right tool for the job. I tried JFreeChart, JChart and JOpenChart but none seem to be able to...
8
5676
by: Prabhakar | last post by:
Friends, I have been migrating ASP applications from IIS4.0/NT4.0 to IIS5.0/W2K. All the applications working perfectly except one. This particular application will make use of asp chart object....
0
1824
by: Robert Kilroy | last post by:
Greetings, I'm sure there's an answer out there to this question. But I've been looking for about 2 days and haven't found it yet. Maybe I'm just not asking the right question. I need to get...
3
2651
by: Quick Function | last post by:
Are there tools to display chart in a web browser? I am looking for something makes beautiful bar char, scatter plot, pie chart, etc in web browser. Thanks, qq
6
6542
by: Tarek | last post by:
hi, May I want to know ASP or Javascript can generate a chart (pie chart) ? or other method can do that? I feel appreciate that anyone can help me ! ^^' -- Regards, Tarek ^^'
3
3042
by: langhammer | last post by:
Hi, anybody knows a good class who makes possible to create charts as line-graph ? Mostly I can find only classes to include with more as 50kilobytes. But I need a small programm, because I...
2
2784
by: Homer | last post by:
Hi, Have a quick question: Lets say I have a Hashtable of values hence 56 37.890 1 12.768 5 9.764 etc.... Is there a way for me to draw a chart in C# of this. FYI its actually lottery...
5
10414
by: Kuna | last post by:
Hi All, I am trying to create a gantt chart in php by getting data from database. I am using WindowsXp OS and having php-4 and my-sql DB. I have installed the JPGRAPH package to my system and...
2
3346
JustRun
by: JustRun | last post by:
Hi, I'm new to Java "I loved it" and i'm stuck with a Chart Applet i'm trying to give the pie chart its values from my database. Actually the database class works when i tested it in main method...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.