To my Inventory Program Part 4 there are three parts and I was able to compile successfully with the first two. I end up get several errors with part 3 and I am unsure to why. This is what I have.

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.GridLayout;

class Inventory {

    String number; //stores product number
    String name; //stores product name
    int quantity; //stores quanity in stock
    double price; //stores product price

    public Inventory(String Num, String N,  int Q, double P)
    {
        number = Num;
        name = N;
        quantity = Q;
        price = P;
    }

    public void setName(String N) //Method to set and get the product name
    {
        name = N;
    }
    public String getName()
    {
        return name;
    }

    public void setNumber(String Num) //Method to set and get the product number
    {
        number = Num;
    }
    public String getNumber()
    {
        return number;
    }

    public void setQuantity(int Q) //Method to set and get the quantity in stock
    {
        quantity = Q;
    }
    public int getQuantity()
    {
        return quantity;
    }

    public void setPrice(double P) //Method to set and get the price
    {
        price = P;
    }
    public double getPrice()
    {
        return price;
    }

    public double getInventoryValue() //Method to calculate the value of the in stock inventory
    {
        return price * quantity;
    }

    public String toString()
    {
        return "Product Name: "+name + "\nProduct Number: "+number+"\nProduct Price: $"+price+"\nQuantity in Stock: "+quantity + "\nInventory Value: $"+getInventoryValue();
    }
} // end Inventory Class





class Product extends Inventory {

    String brand;   // Subclass to add products name brand
    double restockFee;  // Restock fee to add to inventory value

    // initialize product constructor
    public Product(String brand, double restockFee, String Num, String N,  int Q,  double P)
    {
        super(Num, N, Q, P);
        this.brand = brand;
        this.restockFee = restockFee;
    }

    public Product(String brand, String Num, String N,  int Q, double P)
    {
        super(Num, N, Q, P);
        this.brand = brand;
        // the default restocking fee is 5%
        this.restockFee = 0.05;
    }

    public void setBrandName(String brand)
    {
        brand = brand;
    }
    public String getBrandName()
    {
        return brand;
    }

    public double getRestockFee() // Figures restocking fee of inventory
    {
        return super.getInventoryValue() * restockFee;
    }

    public double getInventoryValue() // Figures total inventory value including restocking fee
    {
        return  super.getInventoryValue() + (super.getInventoryValue() * restockFee);
    }

    public String toString()
    {
        StringBuffer sb = new StringBuffer("\nBrand: ").append(brand).append("\n");
        sb.append(super.toString());

        return sb.toString();
    }

} // End Product Class

This is the third part is where I am running into a problem.

public class Inventory4 extends JFrame
{

    //create inventory for the office supplies
    Inventory2 ProductInventory2;

    // index in the supply inventory of the currently displayed office supply. starts at 0, goes to the number of supplies in the inventory - 1
    int index = 0;

    // GUI elements to display currently selected office supply's information
    private final JLabel nameLabel = new JLabel(" Product Name: ");
    private JTextField nameText;

    private final JLabel numberLabel = new JLabel(" Product Number: ");
    private JTextField numberText;

    private final JLabel brandLabel = new JLabel(" Brand: ");
    private JTextField brandText;

    private final JLabel priceLabel = new JLabel(" Price: ");
    private JTextField priceText;

    private final JLabel quantityLabel = new JLabel(" Quantity: ");
    private JTextField quantityText;

    private final JLabel valueLabel = new JLabel(" Value: ");
    private JTextField valueText;

    private final JLabel restockFeeLabel = new JLabel(" Restocking Fee: ");
    private JTextField restockFeeText;

    private final JLabel totalValueLabel = new JLabel(" Inventory Total: ");
    private JLabel totalValueText;

    // go to the next product in the list
    private Action nextAction  = new AbstractAction("Next") {
        public void actionPerformed(ActionEvent evt) {

            // go forward one office supply
            index++;

            // check to see if there is a next office supply
            if (index == ProductInventory2.getSize()) {
                // if at the last office supply in the list, then we can't go any further
                // so back up
                index--;
            }

            repaint();
        }
    };
    private JButton nextButton = new JButton(nextAction);

    public void addProductToInventory2(Product temp)
    {
        ProductInventory2.addProduct(temp);
        repaint();
    }
    public void sortProductInventory2()
    {
        ProductInventory2.sortInventory2();
        repaint();
    }

    public Inventory4(int maximum_number_of_supplies)
    {
        // create the inventory object that will hold the office supply information
        ProductInventory2 = new Inventory2(maximum_number_of_supplies);

        // setup the GUI
        // add the next office supply button to the top of the GUI
        // setup a panel to collect all the buttons in a FlowLayout
        JPanel buttonPanel = new JPanel();
        buttonPanel.add(nextButton);
        getContentPane().add(buttonPanel, BorderLayout.NORTH);

        // product information
        // setup a panel to collect all the components.
        JPanel centerPanel = new JPanel(new GridLayout(8, 2, 0, 4));

        centerPanel.add(nameLabel);
        nameText = new JTextField("");
        nameText.setEditable(false);
        centerPanel.add(nameText);

        centerPanel.add(numberLabel);
        numberText = new JTextField("");
        numberText.setEditable(false);
        centerPanel.add(numberText);

        centerPanel.add(brandLabel);
        brandText = new JTextField("");
        brandText.setEditable(false);
        centerPanel.add(brandText);

        centerPanel.add(priceLabel);
        priceText = new JTextField("");
        priceText.setEditable(false);
        centerPanel.add(priceText);

        centerPanel.add(quantityLabel);
        quantityText = new JTextField("");
        quantityText.setEditable(false);
        centerPanel.add(quantityText);

        centerPanel.add(valueLabel);
        valueText = new JTextField("");
        valueText.setEditable(false);
        centerPanel.add(valueText);

        centerPanel.add(restockFeeLabel);
        restockFeeText = new JTextField("");
        restockFeeText.setEditable(false);
        centerPanel.add(restockFeeText);

        // add the overall inventory information to the panel
        centerPanel.add(totalValueLabel);
        totalValueText = new JLabel("");
        centerPanel.add(totalValueText);

        // add the panel to the center of the GUI's window
        getContentPane().add(centerPanel, BorderLayout.CENTER);

        repaint();
    }

    // repaint the GUI with new Product information
    public void repaint() {

        Product temp = ProductInventory2.getProduct(index);

        if (temp != null) {
            nameText.setText( temp.getName() );
            numberText.setText( ""+temp.getNumber() );
            brandText.setText( temp.getBrandName() );
            priceText.setText( String.format("$%.2f", temp.getPrice()) );
            quantityText.setText( ""+temp.getQuantity() );
            valueText.setText( String.format("$%.2f", temp.getPrice() * temp.getQuantity() ) );
            restockFeeText.setText( String.format("$%.2f", temp.getRestockFee() ) );
        }

        totalValueText.setText( String.format("$%.2f", ProductInventory2.getTotalValueOfAllInventory() ) );

    }

    public static void main(String args[])
    {

        // create a new GUI object that will hold a maximum of 6 office supplies
        Inventory4 Product_GUI = new Inventory4 (6);

        // Add the office supplies to the inventory
        Product_GUI.addProductToInventory2(new Product("Gel Glide" , "1","Rollerball Pens" , 26, 1.00));
        Product_GUI.addProductToInventory2(new Product("Sharpie" , "2","Markers" , 23,  2.00));
        Product_GUI.addProductToInventory2(new Product("Bic",  "3","White-out", 7,  3.00));
        Product_GUI.addProductToInventory2(new Product("Generic", "4","Lead Pencils" , 12, 4.00));
                Product_GUI.addProductToInventory2(new Product("Crayola", "5", "Crayons", 12, 5.00));
                Product_GUI.addProductToInventory2(new Product("Rose Art", "6", "Paint Set", 12, 6.00));

        // sort the office supplies by name
        Product_GUI.sortProductInventory2();

        // Get the GUI to show up on the screen
        Product_GUI.setDefaultCloseOperation( EXIT_ON_CLOSE );
        Product_GUI.pack();
        Product_GUI.setSize(600, 275);
        Product_GUI.setResizable(false);
        Product_GUI.setLocationRelativeTo( null );
        Product_GUI.setVisible(true);

        return;

    }
}  // End Inventory4 class

The errors I am receiving are:

C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:1: error: cannot find symbol
public class Inventory4 extends JFrame
                                ^
  symbol: class JFrame
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:5: error: cannot find symbol
    Inventory2 ProductInventory2;
    ^
  symbol:   class Inventory2
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:11: error: cannot find symbol
    private final JLabel nameLabel = new JLabel(" Product Name: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:12: error: cannot find symbol
    private JTextField nameText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:14: error: cannot find symbol
    private final JLabel numberLabel = new JLabel(" Product Number: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:15: error: cannot find symbol
    private JTextField numberText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:17: error: cannot find symbol
    private final JLabel brandLabel = new JLabel(" Brand: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:18: error: cannot find symbol
    private JTextField brandText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:20: error: cannot find symbol
    private final JLabel priceLabel = new JLabel(" Price: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:21: error: cannot find symbol
    private JTextField priceText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:23: error: cannot find symbol
    private final JLabel quantityLabel = new JLabel(" Quantity: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:24: error: cannot find symbol
    private JTextField quantityText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:26: error: cannot find symbol
    private final JLabel valueLabel = new JLabel(" Value: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:27: error: cannot find symbol
    private JTextField valueText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:29: error: cannot find symbol
    private final JLabel restockFeeLabel = new JLabel(" Restocking Fee: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:30: error: cannot find symbol
    private JTextField restockFeeText;
            ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:32: error: cannot find symbol
    private final JLabel totalValueLabel = new JLabel(" Inventory Total: ");
                  ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:33: error: cannot find symbol
    private JLabel totalValueText;
            ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:36: error: cannot find symbol
    private Action nextAction  = new AbstractAction("Next") {
            ^
  symbol:   class Action
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:52: error: cannot find symbol
    private JButton nextButton = new JButton(nextAction);
            ^
  symbol:   class JButton
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:11: error: cannot find symbol
    private final JLabel nameLabel = new JLabel(" Product Name: ");
                                         ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:14: error: cannot find symbol
    private final JLabel numberLabel = new JLabel(" Product Number: ");
                                           ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:17: error: cannot find symbol
    private final JLabel brandLabel = new JLabel(" Brand: ");
                                          ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:20: error: cannot find symbol
    private final JLabel priceLabel = new JLabel(" Price: ");
                                          ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:23: error: cannot find symbol
    private final JLabel quantityLabel = new JLabel(" Quantity: ");
                                             ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:26: error: cannot find symbol
    private final JLabel valueLabel = new JLabel(" Value: ");
                                          ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:29: error: cannot find symbol
    private final JLabel restockFeeLabel = new JLabel(" Restocking Fee: ");
                                               ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:32: error: cannot find symbol
    private final JLabel totalValueLabel = new JLabel(" Inventory Total: ");
                                               ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:36: error: cannot find symbol
    private Action nextAction  = new AbstractAction("Next") {
                                     ^
  symbol:   class AbstractAction
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:52: error: cannot find symbol
    private JButton nextButton = new JButton(nextAction);
                                     ^
  symbol:   class JButton
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:68: error: cannot find symbol
        ProductInventory2 = new Inventory2(maximum_number_of_supplies);
                                ^
  symbol:   class Inventory2
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:73: error: cannot find symbol
        JPanel buttonPanel = new JPanel();
        ^
  symbol:   class JPanel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:73: error: cannot find symbol
        JPanel buttonPanel = new JPanel();
                                 ^
  symbol:   class JPanel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:75: error: cannot find symbol
        getContentPane().add(buttonPanel, BorderLayout.NORTH);
                                          ^
  symbol:   variable BorderLayout
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:75: error: cannot find symbol
        getContentPane().add(buttonPanel, BorderLayout.NORTH);
        ^
  symbol:   method getContentPane()
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:79: error: cannot find symbol
        JPanel centerPanel = new JPanel(new GridLayout(8, 2, 0, 4));
        ^
  symbol:   class JPanel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:79: error: cannot find symbol
        JPanel centerPanel = new JPanel(new GridLayout(8, 2, 0, 4));
                                 ^
  symbol:   class JPanel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:79: error: cannot find symbol
        JPanel centerPanel = new JPanel(new GridLayout(8, 2, 0, 4));
                                            ^
  symbol:   class GridLayout
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:82: error: cannot find symbol
        nameText = new JTextField("");
                       ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:87: error: cannot find symbol
        numberText = new JTextField("");
                         ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:92: error: cannot find symbol
        brandText = new JTextField("");
                        ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:97: error: cannot find symbol
        priceText = new JTextField("");
                        ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:102: error: cannot find symbol
        quantityText = new JTextField("");
                           ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:107: error: cannot find symbol
        valueText = new JTextField("");
                        ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:112: error: cannot find symbol
        restockFeeText = new JTextField("");
                             ^
  symbol:   class JTextField
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:118: error: cannot find symbol
        totalValueText = new JLabel("");
                             ^
  symbol:   class JLabel
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:122: error: cannot find symbol
        getContentPane().add(centerPanel, BorderLayout.CENTER);
                                          ^
  symbol:   variable BorderLayout
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:122: error: cannot find symbol
        getContentPane().add(centerPanel, BorderLayout.CENTER);
        ^
  symbol:   method getContentPane()
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:164: error: cannot find symbol
        Product_GUI.setDefaultCloseOperation( EXIT_ON_CLOSE );
                                              ^
  symbol:   variable EXIT_ON_CLOSE
  location: class Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:165: error: cannot find symbol
        Product_GUI.pack();
                   ^
  symbol:   method pack()
  location: variable Product_GUI of type Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:166: error: cannot find symbol
        Product_GUI.setSize(600, 275);
                   ^
  symbol:   method setSize(int,int)
  location: variable Product_GUI of type Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:167: error: cannot find symbol
        Product_GUI.setResizable(false);
                   ^
  symbol:   method setResizable(boolean)
  location: variable Product_GUI of type Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:168: error: cannot find symbol
        Product_GUI.setLocationRelativeTo( null );
                   ^
  symbol:   method setLocationRelativeTo(<null>)
  location: variable Product_GUI of type Inventory4
C:\Users\Owner\Desktop\Inventory Program Part 4\Inventory4.java:169: error: cannot find symbol
        Product_GUI.setVisible(true);
                   ^
  symbol:   method setVisible(boolean)
  location: variable Product_GUI of type Inventory4

missing imports... Which should have been obvious from the errors you're getting.

As jwenting said, these are missing imports. I have a feeling that you're a begginer and you're going through some tutorials just copying code.

If you have done anything previous to this by using the above method, awesome! I would suggest going back a few steps and redoing what you need to do without looking at completed code.

Also, here are some recommended projects for beginners from the "Java Projects for Learners" thread.

Keeping in mind with the aspect of "for learners", Here are some projects I started out with.

THESE ARE ALL TEXT BASED(NO GUI)

Area Calculator
Calculate the area given the shape and dimensions needed, then output.

Blackjack
Make a Blackjack game that asks the user if he wants to hit. Check for
bust if total exceeds 21.

Calculator
Simple addition, subtraction, division, and multiplication calculator.

Ceasar Cipher
Encrypt a String given a shift value.
See This.

Fibonnaci Sequence
Calculate the fibonnaci sequence up to a given number of times.

Grading Program
Output a mark(A, B, C, D, or F) given a number 0-100.
F = 0 - 59
D = 60 - 69
C = 70 - 79
B = 80 - 89
A = 90 - 100
EXTRA: Change A to 90 - 99 and give A++ for 100.

Guess My Number
Have the computer generate a number that the user has to guess correctly,
if the user guesses incorectly, have the user guess again. Also, tell the
user if the guess was too high, or too low.

String Reverser
Ask the user for a String, then reverse the string and output.

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.