I have written some code for an Inventory program that I am working on for a Java Class. I keep getting the cannot find symbol error. I have been trying to fix it and can not. Some simple guidence would be nice. Here is what I have already with errors on line 10, 21, 22, 23, 24, and 27.
// inventory program part4
// by Jason Waldrop
import javax.swing.*;
import java.awt.event.*;
public class Inventory4 extends JFrame {
private JTextArea text;
private Inventory inv;
private int view;
public Inventory4() {
super("DVD");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // If the window is to be closed then it quits
view = 0; // Current viewing
// my products
DVD p1 = new DVD(1,"Superbad",3,15.49);
DVD p2 = new DVD(2,"Full Metal Jacket",7,17.29);
DVD p3 = new DVD(3,"Transformers",5,19.99);
DVD p4 = new ExtendedDVD(3,"Shawshank Redemption",5,14.99,"Frank Darabont");
//My inventory entered in:
inv = new Inventory(3);
inv.add(p1);
inv.add(p2);
inv.add(p3);
inv.add(p4);
// output the products
inv.view();
//My Graphical User Interface
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
text = new JTextArea(20,50);
text.setEditable(false);
panel.add(text);
showDVD();
JButton next = new JButton("Next");
next.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (view < inv.size()-1) view++;
else view = 0;
showDVD();
}
});
panel.add(next);
getContentPane().add(panel);
}
// This is where we view the DVD
public void showDVD() {
text.setText("DVD Details:\n");
text.append(inv.get(view).toString()+"\n");
text.append(String.format
("The value of all my Dvds: $%.2f", inv.value()));
}
public static void main(String args [])
{
Inventory4 invt = new Inventory4();
invt.pack();
invt.setVisible(true);
} //end main
}