Can someone help me with what i am missing in this code. I can't get it to compile. Thx! -
import javax.swing.*;
-
-
public class PlaceRocks
-
{
-
-
private static final int GRID_SIZE = 3;
-
private static final String ROW_PROMPT = "Enter a row from: 0, 1, 2";
-
private static final String COLUMN_PROMPT =
-
"Enter a column from: 0, 1, 2";
-
private static final String DENIED = "This row/column is already taken.";
-
private static final String ACCEPTED = "Done.";
-
-
-
public static void main(String[] s)
-
{
-
boolean[] columns = new boolean[GRID_SIZE];
-
boolean[] rows = new boolean[GRID_SIZE];
-
-
-
for(int j = 0; j < 3; j++)
-
{
-
String inputRow = JOptionPane.showInputDialog(ROW_PROMPT);
-
int rowNumber = Integer.parseInt(inputRow);
-
-
String inputColumn = JOptionPane.showInputDialog(COLUMN_PROMPT);
-
int columnNumber = Integer.parseInt(inputColumn);
-
-
if (isCellTaken(rowNumber, columnNumber,
-
rows, columns))
-
{
-
JOptionPane.showMessageDialog(null, DENIED);
-
}
-
else
-
{
-
rows[rowNumber] = true;
-
columns[columnNumber] = true;
-
JOptionPane.showMessageDialog(null, ACCEPTED);
-
}
-
}
-
}
-
-
-
private static boolean isCellTaken(rows, columns, row, column)
-
{
-
if(rows[row] && columns[column])
-
{
-
return true;
-
}
-
else
-
{
-
return false;
-
}
-
-
}
-
-
}
3 1134
Can someone help me with what i am missing in this code. I can't get it to compile. Thx!
The compiler must've spewed out a bit more than "I can't compile this". Copy
and paste the compiler diagnostic message(s) here and we'll see if we can help.
kind regards,
Jos
D:\Documents and Settings\amy.asher\My Documents\ICS 141\PlaceRocks.java:43: <identifier> expected
private static boolean isCellTaken(rows, columns, row, column)
^
D:\Documents and Settings\amy.asher\My Documents\ICS 141\PlaceRocks.java:54: ')' expected
}
^
D:\Documents and Settings\amy.asher\My Documents\ICS 141\PlaceRocks.java:43: cannot resolve symbol
symbol : class rows
location: class PlaceRocks
private static boolean isCellTaken(rows, columns, row, column)
^
D:\Documents and Settings\amy.asher\My Documents\ICS 141\PlaceRocks.java:28: isCellTaken(rows) in PlaceRocks cannot be applied to (int,int,boolean[],boolean[])
if (isCellTaken(rowNumber, columnNumber,
^
D:\Documents and Settings\amy.asher\My Documents\ICS 141\PlaceRocks.java:43: missing method body, or declare abstract
private static boolean isCellTaken(rows, columns, row, column)
^
5 errors
Tool completed with exit code 1
Your curly brackets and/or parentheses aren't balanced; check them all.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Roy Riddex |
last post by:
I have a text file which holds data for 30 cars in the following way:
CarRegistration CarType CarClass Available
I'm trying to display the full contents of this...
|
by: amita |
last post by:
when i am writing a program in c# using windows app I am getting this error
message as System.Windows.Forms.Control.Text is inaccessable due to its
protection level.
In the design window when i...
|
by: pamelafluente |
last post by:
I am beginning aspNet, I know well win apps.
Need a simple and schematic code example to start work.
This is what I need to accomplish:
----------------------
Given button and a TextBox on a...
|
by: pradeepbadiger |
last post by:
Hi,
I created a visual component class in C# which is derived from System.Windows.Forms.UserControl.
Now i want to place it on the grid....I m not able to assign the control to the grid cell....
|
by: derik |
last post by:
04:57:10 172.16.30.239 GET /name/Admin.aspx 200
04:57:10 172.16.30.239 GET /name/Admin_topbanner.aspx 200
can any one help me in delimiting this
these text should be placed in a data grid...
|
by: saytri |
last post by:
Hi i have this project were i have to do a quiz. i wrote the questions in a textfile and i called them through java. I have also made a menu to choose which type of quiz. But before accessing the...
|
by: saytri |
last post by:
I have a problem with this code. I'm, doing a quiz, and the questions are stored in a binary file. My problem is how am i going to compare the answers entered by the user to the correct answers. The...
|
by: Energizer100 |
last post by:
public class fly extends Actor
{
public fly()
{
setColor(Color.BLACK);
}
public fly(Color flyColor)
{
setColor(flyColor);
|
by: Guilherme Polo |
last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote:
Come on.. "help on lines 384-403", that is not a good way to look for
help. You are supposed to post some minimal code that...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |