The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

PLEASE HELP!!!!

Using Netbeans IDE

This is my fourth week of Java coding in class, so I'm fairly new to programming.

My assignment is to calculate information of band member and sales. i have to compare sales of more then one group of band using an array, calculate sales buy the user entering information and compare by which band is the lowest and highest.

NetBeans is saying I have errors of " cannot find symbol" but I am coding by my chapters and I am still confused.

I know that some code is not in the right place because when I put some methods in certain places, netbeans agree with some of the codes, but dont like where I but other parts of the codes.
so right now I am aware that certain pieces of the codes are in the wrong place but only because it helps the rest of the coding in the right places, (kind of confusing but its true)
Here is my code:

packageconcertbookings4;//imports scanner input.importjava.util.Scanner;// imports decmial format.importjava.text.DecimalFormat;publicclass CB4
{// stores value for band as highest selling bandpublicdouble getHighest(){return highest;}double highest = bands[0];{// stores value for band as lowest selling band }publicdouble getLowest(){return lowest;}double lowest = bands[0];//Get items for each band.privatevoid getItems(CB4[]array){String name;int albums,amountBandMem =0, amountOfAttendees;// 1)Number of Band Members // 2) Amount of Attedeesdouble ticketPrice=0 , extraPayment , incentiveAmount ,
amtPerBanMember =0, totalRate=0;// 1)Ticket Price 2)Extra Payment of 15% from ticket price//3) Incentive Amount for each additiona Attendee//4) The amount per band member// 5) Total rate is the amount of incentive amount plus flat rate.int ticketAmount=0;//the amount of ticketsdouble ticketSales;// the amount of tickets sold based by the amount of the//attendees and price of the tickets./*
* Calculation for flat rates, percentage, and acceleration factor.
*/double FRate =350.00,
FRate2 =575.00,
FRate3 =850.00;//Flate rate to band that sold 5 or more albums.float percentage;//Percentage is 15%
percentage = 0.15F;float AccFactor = 33.75F;//acceleration factor
extraPayment = percentage * ticketPrice;// or
extraPayment = AccFactor * ticketPrice;//This calculates exta payment multiply by amount of attendees = //incentive amount.
incentiveAmount = extraPayment * ticketAmount;//this calculates how much each band member will get from the //incentive amount.
amtPerBanMember = totalRate/ amountBandMem;}// Declare money format outputDecimalFormat money =newDecimalFormat("$#,###.00");//Creates Scanner inputpublic Scanner input =new Scanner(System.in);{//allows enteries of three bands.finalint BANDS =3;//creates CB4 array.
CB4[]bands =new CB4 [BANDS];// calls getItems method to retrieve data for each object.
getItems(bands);//displays messages.System.out.println("This program will ask for information of three bands"+" and compare their concert sales.");System.out.println("Welcome, The concert has changed its policy to a "+" new compensation of the band's requirement.");//*****************************************************************// get data for array.for(int index =0; index < bands.length; index ++){// Enters Band NameSystem.out.println("Enter Band's Name "+(index +1));
name[index]= input.nextLine();//Enters amount of members in the Band.System.out.println("Enter the amount of members in the band "+(index +1));
amountBandMem[index]= input.nextInt();//Enters the amount of attendeesSystem.out.println("NOTE: The amount of attendees should be the same amount"+" as tickets solds! "+(index +1));System.out.println("What is the amount of attendees?"+(index +1));
amountOfAttendees[index]= input.nextInt();//asks how many tickets where sold.System.out.println("How many tickets where sold at the concert?"+(index +1));
ticketAmount[index]= input.nextInt();//Enters the ticket priceSystem.out.println("What is the amount of the ticket price?"+(index +1));
ticketPrice[index]= input.nextDouble();/*enters the amount of albums prior sold.
* This also means that for one ticket sold per attendee.
* one ticket = one attendee
*/System.out.print("Enter the amount of albums sold. "+(index +1));
albums[index]= input.nextInt();//Creates CB4 object inialized with data and store the object in array.
bands[index]=new CB4(name,amountBandMem,amountOfAttendees, ticketAmount,ticketPrice,albums);}//display data entered by the user.for(int index =0; index < bands.length; index ++){System.out.println("Name: "+ CB4[index].getname());System.out.println("Number of members: "+ CB4[index].getamountBandMem());System.out.println("Amount of Attendees: "+ CB4[index].getamountOfAttendees());System.out.println("Amount of tickets: "+ CB4[index].getticketAmount());System.out.println("Price of tickets: "+ CB4[index].getticketPrice());System.out.println("Albums Sold: "+ CB4[index].getalbums());}//*****************************************************************//loop for the array bands for albums of each band.for(int index =0; index < bands.length; index ++){/*
* This condition will set the flate rate based on how many albums the band
* has sold and is well known in the industry.
*/if(albums <=1)// if albums sold are less than or equal to one.{/*
* This condition will set the flate rate based on how many albums the band
* has sold and is well known in the industry.
*/if(albums <=1)// if albums sold are less than or equal to one.{
FRate =350.00;System.out.println(" The Bands pay rate will be"+ money.format(FRate));
totalRate = incentiveAmount + FRate;}else{if(albums >2&& albums <4)// albums sold are greater than 2 or less // 4{ FRate2 =575.00;System.out.println(" The Bands pay rate will be"+ money.format(FRate2));
totalRate = incentiveAmount + FRate2;}else{if(albums >=5)// albums that are sold 5 or more{
FRate3 =850.00;System.out.println(" The Bands pay rate will be"+ money.format(FRate3));
totalRate = incentiveAmount + FRate3;}if( ticketAmount ==200)//condition on the amount of tickets sold of 200 // more.{
extraPayment = percentage * ticketPrice;}else{if(ticketAmount >200){
extraPayment = accelerationfactor * incentiveAmount;}}}}}}//*****************************************************************//loop for highest selling band.for(int index =0; index < bands.length; index ++){if(bands[index]> highest)
highest = band[index];}// loop to calculate the lowest seller for(int index =0; index < bands.length; index ++){if(bands[index]< lowest)
lowest = bands [index];}

Last edited by helloworld922; August 14th, 2013 at 04:51 AM.
Reason: please use [code] tags

Re: PLEASE HELP!!!!

Please post the entire error message, not just the shortened "cannot find symbol." Perhaps if you show us the message, we can explain to you what it means and how to use it (and others) to fix the errors yourself.

Re: PLEASE HELP!!!!

The code in the Netbeans project you posted - not the error message like I asked - is missing a few close braces. So is the code you posted in your first post. Why is that?

Have you tried to compile the project? If so, copy and paste the resulting error message and stack trace. If you haven't tried to compile and you're asking about a Netbeans message given prior to compiling in a red squiggly or similar, you should explain that.

Re: PLEASE HELP!!!!

I'm not sure you're right about all variables being declared. I see ~30+/- complaints about variables that haven't been declared. For example: bands, name, amountBandMem, amountOfAttendees, ticketAmount, ticketPrice, albums, CB4 (bad name), etc. Where have those variables been declared?

// 1)Ticket Price 2)Extra Payment of 15% from ticket price
//3) Incentive Amount for each additiona Attendee
//4) The amount per band member
// 5) Total rate is the amount of incentive amount plus flat rate.

int ticketAmount=0; //the amount of tickets

double ticketSales; // the amount of tickets sold based by the amount of the
//attendees and price of the tickets.

Re: PLEASE HELP!!!!

Those variables are declared INSIDE a method so are LOCAL to that method, invisible to references to those LOCAL variables OUTSIDE that method. To declare them so that they can be seen throughout the class, you'd declare them as instance variables as in: