hello all, this is my first post here and I have searched for answers elsewhere before asking for help. My code is pretty tight, but I keep coming up with symbol not found errors. Are my curlys not in the right place? Or have i not declared the objects correctly. I could use a look, because I cannot get it for the life off me. Thank you!

Code

//inventory program
// D Elliott

import java.util.Arrays;
import java.util.Scanner;

public class LP
{
    String album[] = {"Revolver-The Beatles","OK Computer-Radiohead","Person Pitch-Panda Bear","Bleach-Nirvana"};
    double unitNum[] = {1001, 1002, 1003, 1004};
    double price[] = {18.99, 25.98, 24.99, 38.99};
    double quantity[] = {3, 6, 5, 10};
    double total, allTotal ;
    
    public static void main( String args[] )
    {
	Scanner input = new Scanner( System.in );
	LP main = new LP();
	boolean exit = true;
	String option;
	Label label = main.new Label();

	while(exit){
	    System.out.print( "Please enter an option to review the inventory\n\n"+
			    "Albums, Label, Value, or Restock\n" +
			      "or type stop to exit" );
			    option = input.nextLine();
		
	if (option.equalsIgnoreCase("Albums"))	{
		main.displayAlbum();}
	if (option.equalsIgnoreCase("Value")){
		main.invTotal();}
	if (option.equalsIgnoreCase("Stop")){
		exit = false;}
	if (option.equalsIgnoreCase("Label")){
		label.invLabel();}
	if (option.equalsIgnoreCase("Restock")){
		label.calcRestock();}
		    }//end while
		    System.out.println( "Thank You. Goodbye!" );

    }//end main method
    
    public void displayAlbum()
    {
      Scanner input = new Scanner(System.in);
      boolean done = true;
      String  option;
      
      Arrays.sort(album);
      System.out.println( "Albums\n" );
      
      for( int i = 0; 0 < album.length; i++){
	System.out.println( i+1 + ") " + album[i]);}
	
	while(done){
	  System.out.println( "Type an Album name to view its info, or type enter exit" );
	  option = input.nextLine();
	  int i = 0;
	  if ( !option.equalsIgnoreCase("")){
	    if ( option.equalsIgnoreCase("")){
	      i = 0;}
	    if ( option.equalsIgnoreCase("")){
	      i = 1;}
	    if ( option.equalsIgnoreCase("")){
	      i = 2;}
	    if ( option.equalsIgnoreCase("")){
	      i = 3;}
	  }  
	  total = quantity[i] * price[i];
	  System.out.printf( "\nAlbum:"+album[i]+"\nNumber:"+unitNum[i]+"\nQuantity:"+quantity[i]+"\nPrice:"+price[i]+"\nTotal Stock Price: %.2f", total );
	  System.out.println("");
	  
	  if ( option.equalsIgnoreCase("")){
	    done = false;}
	}//end while
    }//end method displayAlbum
    
    public void invTotal()
    {
      System.out.println( "\tNAME\tNUMBER\tQUANTITY  PRICE\tTOTAL" );
      System.out.println();
      for( int i = 0; i < album.length(); i++)
      {
	
	allTotal += quantity[i] * price[i];
	total = quantity[i] * price[i];
	System.out.printf(i+1 + "\t" + album[i] + "\t" + unitNum[i] + "\t   " + quantity[i] + "\t   $" + price[i] + "    " + "$%.2f" + "\n", total);
      }
      System.out.printf("Total Stock Value: %.2f\n\n ", allTotal);
    }//end method invTotal

    public class Label extends LP
    {
      String label[] = {"Parlaphone","Parlaphone","Pawtracks","Sub-Pop"};
      int labelQuantity;
      int labelTotalPrice;
      double parQuant = quantity[0] + quantity[1];
      double pawQuant = quantity[2];
      double subQuant = quantity[3];
      double parTotal = (parQuant * (price[0] * price[1]));
      double pawtotal = pawQuant * price[2];
      double subTotal = subQuant * price[3];
      double restock;
      double restockTotal;
      
      public void invLabel()
      {
	System.out.println( "Album\tLabel\tQuantity " );
	for ( int i = 0; i < label.length(); i++ )
	{
	  System.out.println( album[i] + "\t" + label[i] + "\t" + quantity[i] );
	  
	}
	System.out.println( "Label\tQuantity\tTotal Label Cost" ); 
	System.out.printf( "Parlaphone %s\t%.2d", parQuant, parTotal );
	System.out.printf( "PawTracks %s\t%.2d", pawQuant, pawtotal );
	System.out.printf( "Sub-Pop %s\t%.2d", subQuant, subTotal );
      }//end method invLabel
      public void calcRestock()
      {
	System.out.println("\tAlbum\tUnit Number\tQUANTITY\tPRICE\t\tTotal\t\tRestock $\tAlbum + Restock $");
			for(int i = 0; i < album.length; i++ ){
				allTotal += quantity[i] * price[i]; 
				total = quantity[i] * price[i]; 
				restock = price[i] * .05; 
				restockTotal = price[i] + restock; 
				System.out.printf(i+1 + "\t" + album[i] + "\t\t" + unitNum[i] + "\t\t" + quantity[i] + "\t\t" + price[i] + "\t\t" + "$%.2f" + "          " +
						"$%.2f" + "\t\t$%.2f" + "\n", total, restock, restockTotal);		
				}
			System.out.printf("Total inventory value: %.2f \n\n", allTotal);
      }
      
    
    }
}

Errors

daniel@NETGEAR:~/workspace$ javac LP.java
LP.java:83: cannot find symbol
symbol  : method length()
location: class java.lang.String[]
      for( int i = 0; i < album.length(); i++)
                               ^
LP.java:110: cannot find symbol
symbol  : method length()
location: class java.lang.String[]
        for ( int i = 0; i < label.length(); i++ )
                                  ^
2 errors

To return the length of an array, use array.length
Not array.length()

oh wow! thanks! I knew it was something simple that I was over looking. Thank you again!

No problem, mark as solved if you have no other questions.

hello all, this is my first post here and I have searched for answers elsewhere before asking for help. My code is pretty tight, but I keep coming up with symbol not found errors. Are my curlys not in the right place? Or have i not declared the objects correctly. I could use a look, because I cannot get it for the life off me. Thank you!

Code

//inventory program
// D Elliott

import java.util.Arrays;
import java.util.Scanner;

public class LP
{
    String album[] = {"Revolver-The Beatles","OK Computer-Radiohead","Person Pitch-Panda Bear","Bleach-Nirvana"};
    double unitNum[] = {1001, 1002, 1003, 1004};
    double price[] = {18.99, 25.98, 24.99, 38.99};
    double quantity[] = {3, 6, 5, 10};
    double total, allTotal ;
    
    public static void main( String args[] )
    {
	Scanner input = new Scanner( System.in );
	LP main = new LP();
	boolean exit = true;
	String option;
	Label label = main.new Label();

	while(exit){
	    System.out.print( "Please enter an option to review the inventory\n\n"+
			    "Albums, Label, Value, or Restock\n" +
			      "or type stop to exit" );
			    option = input.nextLine();
		
	if (option.equalsIgnoreCase("Albums"))	{
		main.displayAlbum();}
	if (option.equalsIgnoreCase("Value")){
		main.invTotal();}
	if (option.equalsIgnoreCase("Stop")){
		exit = false;}
	if (option.equalsIgnoreCase("Label")){
		label.invLabel();}
	if (option.equalsIgnoreCase("Restock")){
		label.calcRestock();}
		    }//end while
		    System.out.println( "Thank You. Goodbye!" );

    }//end main method
    
    public void displayAlbum()
    {
      Scanner input = new Scanner(System.in);
      boolean done = true;
      String  option;
      
      Arrays.sort(album);
      System.out.println( "Albums\n" );
      
      for( int i = 0; 0 < album.length; i++){
	System.out.println( i+1 + ") " + album[i]);}
	
	while(done){
	  System.out.println( "Type an Album name to view its info, or type enter exit" );
	  option = input.nextLine();
	  int i = 0;
	  if ( !option.equalsIgnoreCase("")){
	    if ( option.equalsIgnoreCase("")){
	      i = 0;}
	    if ( option.equalsIgnoreCase("")){
	      i = 1;}
	    if ( option.equalsIgnoreCase("")){
	      i = 2;}
	    if ( option.equalsIgnoreCase("")){
	      i = 3;}
	  }  
	  total = quantity[i] * price[i];
	  System.out.printf( "\nAlbum:"+album[i]+"\nNumber:"+unitNum[i]+"\nQuantity:"+quantity[i]+"\nPrice:"+price[i]+"\nTotal Stock Price: %.2f", total );
	  System.out.println("");
	  
	  if ( option.equalsIgnoreCase("")){
	    done = false;}
	}//end while
    }//end method displayAlbum
    
    public void invTotal()
    {
      System.out.println( "\tNAME\tNUMBER\tQUANTITY  PRICE\tTOTAL" );
      System.out.println();
      for( int i = 0; i < album.length(); i++)
      {
	
	allTotal += quantity[i] * price[i];
	total = quantity[i] * price[i];
	System.out.printf(i+1 + "\t" + album[i] + "\t" + unitNum[i] + "\t   " + quantity[i] + "\t   $" + price[i] + "    " + "$%.2f" + "\n", total);
      }
      System.out.printf("Total Stock Value: %.2f\n\n ", allTotal);
    }//end method invTotal

    public class Label extends LP
    {
      String label[] = {"Parlaphone","Parlaphone","Pawtracks","Sub-Pop"};
      int labelQuantity;
      int labelTotalPrice;
      double parQuant = quantity[0] + quantity[1];
      double pawQuant = quantity[2];
      double subQuant = quantity[3];
      double parTotal = (parQuant * (price[0] * price[1]));
      double pawtotal = pawQuant * price[2];
      double subTotal = subQuant * price[3];
      double restock;
      double restockTotal;
      
      public void invLabel()
      {
	System.out.println( "Album\tLabel\tQuantity " );
	for ( int i = 0; i < label.length(); i++ )
	{
	  System.out.println( album[i] + "\t" + label[i] + "\t" + quantity[i] );
	  
	}
	System.out.println( "Label\tQuantity\tTotal Label Cost" ); 
	System.out.printf( "Parlaphone %s\t%.2d", parQuant, parTotal );
	System.out.printf( "PawTracks %s\t%.2d", pawQuant, pawtotal );
	System.out.printf( "Sub-Pop %s\t%.2d", subQuant, subTotal );
      }//end method invLabel
      public void calcRestock()
      {
	System.out.println("\tAlbum\tUnit Number\tQUANTITY\tPRICE\t\tTotal\t\tRestock $\tAlbum + Restock $");
			for(int i = 0; i < album.length; i++ ){
				allTotal += quantity[i] * price[i]; 
				total = quantity[i] * price[i]; 
				restock = price[i] * .05; 
				restockTotal = price[i] + restock; 
				System.out.printf(i+1 + "\t" + album[i] + "\t\t" + unitNum[i] + "\t\t" + quantity[i] + "\t\t" + price[i] + "\t\t" + "$%.2f" + "          " +
						"$%.2f" + "\t\t$%.2f" + "\n", total, restock, restockTotal);		
				}
			System.out.printf("Total inventory value: %.2f \n\n", allTotal);
      }
      
    
    }
}

Errors

daniel@NETGEAR:~/workspace$ javac LP.java
LP.java:83: cannot find symbol
symbol  : method length()
location: class java.lang.String[]
      for( int i = 0; i < album.length(); i++)
                               ^
LP.java:110: cannot find symbol
symbol  : method length()
location: class java.lang.String[]
        for ( int i = 0; i < label.length(); i++ )
                                  ^
2 errors

Hi there.. you only hava two same errors as far as I know.. in line 84 and 111. Array.length() is wrong. length is not a method, so take the braces out. it should just be album.length and label.length... no braces. it should compile after you take the braces out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.