Question:
Java error message: How to fix?????!!!!?
anonymous
2010-04-04 21:26:45 UTC
I am getting the following error message:
cannot find symbol
symbol: variable bandLayoutF on line 112 (Very last line posted here)
If anyone can help me solve this error so this program will compile, please respond ASAP! THANKS!!!!!!!


public static void main(String[] args) {

int index, position, positionNumber;
int index2,numberOfRows,rowNumber,weight;
double weightOfRow, avgWeightRow;
char row,rowLetter,option ;
row = (char)65;

System.out.println("Welcome to the Band of the Hour");
System.out.println("-------------------------------");


System.out.print("Please enter number of rows:");
numberOfRows = keyboard.nextInt();

if(numberOfRows >=0 && numberOfRows <11) {
numberOfRows = numberOfRows;
}else{
do{
System.out.print("ERROR: Out of range, try again:");
numberOfRows = keyboard.nextInt();
} while(numberOfRows <0 || numberOfRows >10);
}


char[] rowArray = new char [numberOfRows];
for (index = 0; index < rowArray.length ; index ++) {
rowArray [index] = row++;
}

int[][] bandLayout = new int [rowArray.length][];
for (index = 0; index < rowArray.length ; index ++) {

System.out.print(" Please enter number of positions in row " + (rowArray[index]) + ":");
position = keyboard.nextInt();
if(position >=0 && position <9) {
position = position;
bandLayout[index] = new int [position];
}else{
do{
System.out.print("ERROR: Out of range, try again:");
position = keyboard.nextInt();
bandLayout[index] = new int [position];
} while (position <0 || position >8);
}
double bandLayoutF[][]= new double[index][position];
}



do {
keyboard.nextLine();
System.out.print("(A)dd, (R)emove, (P)rint, e(X)it: ");
option = Character.toUpperCase(keyboard.next().charAt(0));
switch (option) {
case 'A':
System.out.print("Please enter row letter : ");
rowLetter = Character.toUpperCase(keyboard.next().charAt(0));
if(rowLetter >= (char)65 && rowLetter <(char)68) {
rowLetter = rowLetter;
rowNumber = ((char)rowLetter)-65;
rowArray[rowNumber] = rowLetter;
}else{
do{
System.out.print("ERROR: Out of range, try again:");
rowLetter = Character.toUpperCase(keyboard.next().charAt(0));
rowNumber = ((char)rowLetter)-65;
rowArray[rowNumber] = rowLetter;

} while (rowLetter <(char) 65 || rowLetter >(char) 67);
}
System.out.println("");

System.out.print("Please enter position number (1 to 4) :");
positionNumber = keyboard.nextInt();
if(positionNumber >= 1 && positionNumber < 5) {
positionNumber = positionNumber;
}else{
do {
System.out.print("ERROR: Out of range, try again:");
positionNumber = keyboard.nextInt();
} while (positionNumber <1 || positionNumber >4);
}
System.out.print("Please enter weight (45.0 to 200.0) :");
weight = keyboard.nextInt();
if(weight >=45 && weight <=200) {
weight = weight;
}else{
do {
System.out.print("ERROR: Out of range, try again:");
weight = keyboard.nextInt();
} while (weight <45 || weight >200);
}
bandLayout[rowNumber][positionNumber] = weight;
System.out.print("****** Musician added");
break;
case 'R':
System.out.print("Please enter row letter : ");
Three answers:
Philip1234
2010-04-04 21:35:42 UTC
Install Eclipse so you can debug the code and it will fix all your problems....it seems it just can't find the pointer...is something private and your not accessing it properly
spadequack
2010-04-04 21:45:16 UTC
Is this line 112:

double bandLayoutF[][]= new double[index][position];

?



If so, I don't see anything wrong with the code up to there. I literally copied your code up to there, ended main() with a } and added in a static Scanner variable called keyboard and your code compiled just fine. Maybe you meant a different line that got cut off?
?
2016-12-10 20:09:13 UTC
What you are able to do, is to uninstall Google Chrome (YouTube classified ads about Google Chrome is fake, they actually said that because they ought to; considering the fact that Google held YouTube it had many insects! Google sucks!) then see in case you are able to watch videos now. also, you are able to opt to attempt Mozilla instead. it truly is swifter and has more beneficial helpful factors!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...