I can't figure out why I am recieving error messages from the compiler that tells me that I have an illegal start of the expression for the code that is in red. I have also put the product class that goes with the main class; I'm not sure if the product class is a cause of the error or not because I am new to Java. Can someone tell what I am doing wrong and how to fix it?
import java.util.Scanner; //input scanner
public class Inventory
{
// main method begin program execution
public static void main( String args[] )
{
public String productName; // product name
public double number; // product item number
public double units; // number of units in stock
public double price; // price per unit
public double value; // total value of all units in stock
// scanner to obtain user input
Scanner input = new Scanner ( System.in );
// scanner product object
{
Product = new Product(productName, number, units, price);
}
// value total of all units
{
System.out.printf(p.toString() );
}
} // end main method
} // end Inventory class
Here is the product class that goes with the inventory class
public class Product
{
private String productName; //product name
private double number; // item number
private double units; // number of units in stock
private double price; // price per unit
private double value; // total value of all units in stock
//constuctor to initialize productName
public Product( String name, double item_number, double units_stocked, double price_unit, double value_total )
{
productName = name;
number = item_number;
units = units_stocked;
price = price_unit;
} // end constuctor
// method to set product name
public void setProductName( String name )
{
productName = name;
} // end method setProductName
// method to set item number
public void setNumber(int item_number)
{
number = item_number;
} // end method setNumber
// method to set units in stock
public void setUnits(int units_stocked)
{
units = units_stocked;
} // end method setUnits
// method to set price per unit
public void setPrice(int price_unit)
{
price = price_unit;
} // end method setPrice
// method to retrieve product name
public String getProductName()
{
return productName;
} // end method getProductName
// method to retrieve item number
public double getNumber()
{
return number;
} // end method getNumber
// method to retrieve units in stock
public double getUnits()
{
return units;
} // end method getUnits
// method to retrieve price per unit
public double getPrice()
{
return price;
} // end method getPrice
// method to retrieve total value of all units
public double getValue()
{
value = units * price;
return value;
} // end method getValue
} // end product class
Please help.