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:
package concertbookings4; //imports scanner input. import java.util.Scanner; // imports decmial format. import java.text.DecimalFormat; public class CB4 { // stores value for band as highest selling band public double getHighest() { return highest; } double highest = bands[0]; { // stores value for band as lowest selling band } public double getLowest() { return lowest; } double lowest = bands[0]; //Get items for each band. private void getItems(CB4[]array) { String name; int albums,amountBandMem =0, amountOfAttendees; // 1)Number of Band Members // 2) Amount of Attedees double 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 tickets double 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 output DecimalFormat money = new DecimalFormat("$#,###.00"); //Creates Scanner input public Scanner input = new Scanner(System.in); { //allows enteries of three bands. final int 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 Name System.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 attendees System.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 price System.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]; }