I am receiving and error when trying to compile and cannot seem to figure out why and would appreciate any help.

public class Product
{
		private String itemName;    //  variable that stores the cartridge name
		private int itemNumber;    //  variable that stores the item number
		private int invStock;   //  variable that stores the quantity in stock
		private double itemPrice;   //  variable that stores the cartridge price
			
			public Product(String name, int number, int stock, double price) // Constructor for the Inventory3 class
				{
					itemName = name;
					itemNumber = number;
					invStock = stock;
					itemPrice = price;
				}
				
			public void setItemName(String name)  // Method to set the item name
				{
					this.itemName = name;
				}
				
			public String getItemName()  // Method to get the item name
				{
					return itemName;
				}				
			public void setItemNumber(int number)  // Method to set the item number
				{
					this.itemNumber = number;
				}
				
			public int getItemNumber()  // Method to get the item number
				{
					return itemNumber;
				}
				
			public void setinvStock(int stock)  // Method to set the stock in stock
				{
					invStock = stock;
				}
				
			public int getInvStock()  // Method to get the stock in stock
				{
					return invStock;
				}
				
			public void setItemPrice(double price)  // Method to set the item price
				{
					this.itemPrice = price;
				}
				
			public double getItemPrice()  // Method to get the item price
				{
					return itemPrice;
				}
				
			public double getCalculateInventoryValue()  // Method to calculate the value of the inventory
				{
					return (double) itemPrice * invStock;
				}
			
			public int compareTo(Object o)
				{
					Product p = null;
						try
							{
								p = (Product) o;
							}
						
						catch (ClassCastException cE)
							{
								cE.printStackTrace();
							}
						
						return itemName.compareTo(p.getItemName());
				}
 
			public String toString()
				{
					return "\nName: " + itemName + "Item #: " + itemNumber + "\nStock: " + invStock + "\nPrice: $" + itemPrice + "\nValue: $" + calculateInventoryValue();
				}
}  //end class Product

class Cartridge extends Product
{
	private double reStockingFee;
  
		public Cartridge(String itemName, int itemNumber, int invStock, double itemPrice, double reStockingFee) 
			{
           		super(itemName, itemNumber, invStock, itemPrice);
           		this.reStockingFee = reStockingFee;
      		}	
		public double getItemPrice() //returns the value of the inventory, plus the restocking fee
			{
				return super.getItemPrice() + reStockingFee;
			}
 		public String toString() 
			{
				return new StringBuffer().append("Price: " + super.getItemPrice()).append(" With RestockingFee: " + getItemPrice()).toString();
			}
 
} // end class Product
import java.util.Scanner;
import java.util.Arrays; 

public class Inventory3

	{
		public static void main(String args[] )
			{
  		double restockFee = 0.05;    
		
		//Declare and initialize the inventory array
      Product[] inventory = new Product[5]; //Array variables

			inventory[0] = new Product("HP BLACK", 92298, 3, 72.91);
			inventory[1] = new Product("HP 41 COLOR", 51641, 2, 21.29);
			inventory[2] = new Product("HP 78 TRI-COLOR", 6578, 4, 22.45);
			inventory[3] = new Product("HP 102 Gray", 9360, 16, 22.99);
         inventory[4] = new Product("HP Black", 6656, 14, 13.60);
 
 		Product temp[] = new Product[1];
		
			System.out.println("Printer Cartridge Inventory Program"); //display header
			System.out.println(); // blank line
			System.out.println(); // blank line
            for(int i = 0; i < inventory.length; i++)
                {
                    System.out.println("Item Number: " + inventory[i].getItemNumber());
                    System.out.println("Item Name: " + inventory[i].getItemName());
                    System.out.println("Inventory On Hand: " + inventory[i].getInvStock());
                    System.out.printf("Item Price: $%,.2f\n " + inventory[i].getItemPrice());
                    System.out.printf("Value of Inventory: $%,.2f\n " + inventory[i].getValue());
                                
                    System.out.println("Restock Fee: " + (inventory[i].getInvStock() * inventory[i].getItemPrice()) * 0.05);
                    System.out.println();                  

                }  
        }    

} //End class Inventory3

Edited 5 Years Ago by peter_budo: Adding code tags to old post

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

public class Inventory3

	{
		public static void main(String args[] )
			{
  		double restockFee = 0.05;    
		
		//Declare and initialize the inventory array
      Product[] inventory = new Product[5]; //Array variables

			inventory[0] = new Product("HP BLACK", 92298, 3, 72.91);
			inventory[1] = new Product("HP 41 COLOR", 51641, 2, 21.29);
			inventory[2] = new Product("HP 78 TRI-COLOR", 6578, 4, 22.45);
			inventory[3] = new Product("HP 102 Gray", 9360, 16, 22.99);
         inventory[4] = new Product("HP Black", 6656, 14, 13.60);
 
 		Product temp[] = new Product[1];
		
			System.out.println("Printer Cartridge Inventory Program"); //display header
			System.out.println(); // blank line
			System.out.println(); // blank line
            for(int i = 0; i < inventory.length; i++)
                {
                    System.out.println("Item Number: " + inventory[i].getItemNumber());
                    System.out.println("Item Name: " + inventory[i].getItemName());
                    System.out.println("Inventory On Hand: " + inventory[i].getInvStock());
                    System.out.printf("Item Price: $%,.2f\n " + inventory[i].getItemPrice());
                    System.out.printf("Value of Inventory: $%,.2f\n " + inventory[i].getValue());
                                
                    System.out.println("Restock Fee: " + (inventory[i].getInvStock() * inventory[i].getItemPrice()) * 0.05);
                    System.out.println();                  

                }  
        }    

} //End class Inventory3
public class Product
{
		private String itemName;    //  variable that stores the cartridge name
		private int itemNumber;    //  variable that stores the item number
		private int invStock;   //  variable that stores the quantity in stock
		private double itemPrice;   //  variable that stores the cartridge price
			
			public Product(String name, int number, int stock, double price) // Constructor for the Inventory3 class
				{
					itemName = name;
					itemNumber = number;
					invStock = stock;
					itemPrice = price;
				}
				
			public void setItemName(String name)  // Method to set the item name
				{
					this.itemName = name;
				}
				
			public String getItemName()  // Method to get the item name
				{
					return itemName;
				}				
			public void setItemNumber(int number)  // Method to set the item number
				{
					this.itemNumber = number;
				}
				
			public int getItemNumber()  // Method to get the item number
				{
					return itemNumber;
				}
				
			public void setinvStock(int stock)  // Method to set the stock in stock
				{
					invStock = stock;
				}
				
			public int getInvStock()  // Method to get the stock in stock
				{
					return invStock;
				}
				
			public void setItemPrice(double price)  // Method to set the item price
				{
					this.itemPrice = price;
				}
				
			public double getItemPrice()  // Method to get the item price
				{
					return itemPrice;
				}
				
			public double getCalculateInventoryValue()  // Method to calculate the value of the inventory
				{
					return (double) itemPrice * invStock;
				}
			
			public int compareTo(Object o)
				{
					Product p = null;
						try
							{
								p = (Product) o;
							}
						
						catch (ClassCastException cE)
							{
								cE.printStackTrace();
							}
						
						return itemName.compareTo(p.getItemName());
				}
 
			public String toString()
				{
					return "\nName: " + itemName + "Item #: " + itemNumber + "\nStock: " + invStock + "\nPrice: $" + itemPrice + "\nValue: $" + calculateInventoryValue();
				}
}  //end class Product

class Cartridge extends Product
{
	private double reStockingFee;
  
		public Cartridge(String itemName, int itemNumber, int invStock, double itemPrice, double reStockingFee) 
			{
           		super(itemName, itemNumber, invStock, itemPrice);
           		this.reStockingFee = reStockingFee;
      		}	
		public double getItemPrice() //returns the value of the inventory, plus the restocking fee
			{
				return super.getItemPrice() + reStockingFee;
			}
 		public String toString() 
			{
				return new StringBuffer().append("Price: " + super.getItemPrice()).append(" With RestockingFee: " + getItemPrice()).toString();
			}
 
} // end class Product

Learn to interpret compiler errors, if you don't you'll never succeed.
And no, we're not going to guess what "error" you're getting. You tell us and we MAY tell you what it means.

I am receiving and error when trying to compile and cannot seem to figure out why and would appreciate any help.

Errors

C:\Java\Daniweb\Inventory3.java:31: cannot find symbol
symbol  : method getValue()
location: class Product
System.out.printf("Value of Inventory: $%,.2f\n " + inventory[i].getValue());
                                                                                    
C:\Java\Daniweb\Product.java:79: cannot find symbol
symbol  : method calculateInventoryValue()
location: class Product
return "\nName: " + itemName + "Item #: " + itemNumber + "\nStock: " + invStock + "\nPrice: $" + itemPrice + "\nValue: $" + calculateInventoryValue();

Error are absolutely clear, none of the red marked methods exists. Check your Product class and tell me what you found there

Sorry, I am new at this and I meant to be more specific about my errors and just plain forget to include it. I was able just today to figure out my problem, thank you.

This question has already been answered. Start a new discussion instead.