Ok, I am working on an inventory program and this is where I am at thus far. I seem to be getting two errors that I can not figure out. I will post the errors at the end of the code.
Here are the two errors that I recieve
Can not figure out why this will not compile... What am I missing.
Code:
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Inventory extends JFrame// Main class
{
private JLabel prodNameLabel;
private JLabel numberLabel;
private JLabel unitLabel;
private JLabel priceLabel;
private JLabel featureLabel;
private JLabel valueLabel;
private JLabel rstkLabel;
private JLabel totalLabel;
private JTextField prodNameField;
private JTextField numberField;
private JTextField unitField;
private JTextField priceField;
private JTextField featureField;
private JTextField valueField;
private JTextField rstkField;
private JTextField totalField;
private JButton firstBtn;
private JButton prevBtn;
private JButton nextBtn;
private JButton lastBtn;
private JPanel buttonJPanel;
private JPanel fieldJPanel;
private JPanel fontJPanel;
private List<ProductAdd> nwProduct;
private int currProd = 0;
private double total; // variable for total inventory
public Inventory()
{
initComponents();
}
private void initComponents()
{
prodNameLabel = new JLabel("Product Name:");
numberLabel = new JLabel("Item Number:");
unitLabel = new JLabel("In Stock:");
priceLabel = new JLabel("Each Item Cost:");
featureLabel = new JLabel("Type of Item:");
valueLabel = new JLabel("Value of Item Inventory:");
rstkLabel = new JLabel("Cost to Re-Stock Item:");
totalLabel = new JLabel("Total Value of Inventory:");
firstBtn = new JButton("First");
prevBtn = new JButton("Previous");
nextBtn = new JButton("Next");
lastBtn = new JButton("Last");
prodNameField = new JTextField();
prodNameField.setEditable(false);
numberField = new JTextField();
numberField.setEditable(false);
unitField = new JTextField();
unitField.setEditable(false);
priceField = new JTextField();
priceField.setEditable(false);
featureField = new JTextField();
featureField.setEditable(false);
valueField = new JTextField();
valueField.setEditable(false);
rstkField = new JTextField();
rstkField.setEditable(false);
totalField = new JTextField();
totalField.setEditable(false);
prodNameLabel.setSize(200, 20);
numberLabel.setSize(200, 20);
unitLabel.setSize(200, 20);
priceLabel.setSize(200, 20);
featureLabel.setSize(200, 20);
valueLabel.setSize(200, 20);
rstkLabel.setSize(200, 20);
totalLabel.setSize(200, 20);
prodNameField.setSize(100, 20);
numberField.setSize(100, 20);
unitField.setSize(100, 20);
priceField.setSize(100, 20);
featureField.setSize(100, 20);
valueField.setSize(100, 20);
rstkField.setSize(100, 20);
totalField.setSize(100, 20);
buttonJPanel = new JPanel(); // set up panel
buttonJPanel.setLayout( new GridLayout(1, 4)); //set layout
// add buttons to buttonJPanel
buttonJPanel.add(firstBtn);
buttonJPanel.add(prevBtn);
buttonJPanel.add(nextBtn);
buttonJPanel.add(lastBtn);
}
public static void main( String args[])
{
product[] myProduct = new product[5];
//Company[] myCompany = new Company[5];
product p1 = new Company("Mad Dash", 20003, 5, 30, "EIDOS");
product p2 = new Company("Fuzion Frenzy", 74512, 2, 10, "MicroSoft");
product p3 = new Company("Time Splitters 2", 20009, 3, 45, "EIDOS");
product p4 = new Company("Night Caster", 74522, 8, 5, "MicroSoft");
product p5 = new Company("Lego Star Wars II", 32976, 1, 50, "LucasArts");
myProduct[0] = p1;
myProduct[1] = p2;
myProduct[2] = p3;
myProduct[3] = p4;
myProduct[4] = p5;
double totalValue = 0.0;
for (int c=0; c < 5; c++)
{
totalValue = totalValue + myProduct[c].itemCalculate();
}
Arrays.sort(myProduct); // function used to sort arrays
for(product p: myProduct)
{
System.out.println(p);
System.out.println();
}
System.out.println("Total Inventory value is: $"+totalValue);
} //end main
} //end Inventory
Here are the two errors that I recieve
Code:
C:\Users\Brian\Desktop\Java Inventory program\Inventory.java:35: cannot find symbol symbol : class list location: class Inventory private list<ProductAdd> nwProduct; ^ C:\Users\Brian\Desktop\Java Inventory program\Inventory.java:35: cannot find symbol symbol : class ProductAdd location: class Inventory private list<ProductAdd> nwProduct; ^ 2 errors Tool completed with exit code 1
Comment