I have been posting under the other topic I started named Inventory Program. I hope I do not get in trouble, but I am starting a new post because this is a new part of the program and I wasn't receiving any help in the other one. Please forgive me if this is the wrong thing to do. Ok, now on to my code. This is the errors I am getting when I try to compile.
/tmp/13923/JPanel.java:3: cannot find symbol
symbol : class DrawingArea
location: class JPanel
private DrawingArea left = new DrawingArea();
^
/tmp/13923/JPanel.java:4: cannot find symbol
symbol : class DrawingArea
location: class JPanel
private DrawingArea rite = new DrawingArea();
^
/tmp/13923/JPanel.java:32: cannot find symbol
symbol : class Color
location: class JPanel
private static Color randomColor() {
^
/tmp/13923/JFrame.java:12: cannot find symbol
symbol : constructor JFrame(java.lang.String)
location: class JFrame
JFrame frame = new JFrame("Inventory Of Fish");
^
/tmp/13923/JFrame.java:14: cannot find symbol
symbol : method addWindowListener()
location: class JFrame
frame.addWindowListener(new WindowAdapter() {
^
/tmp/13923/JFrame.java:23: cannot find symbol
symbol : method getContentPane()
location: class JFrame
frame.getContentPane().add(jlbempty, BorderLayout.CENTER);
^
/tmp/13923/JFrame.java:25: cannot find symbol
symbol : method pack()
location: class JFrame
frame.pack();
^
/tmp/13923/JFrame.java:26: cannot find symbol
symbol : method setVisible(boolean)
location: class JFrame
frame.setVisible(true);
^
/tmp/13923/JPanel.java:3: cannot find symbol
symbol : class DrawingArea
location: class JPanel
private DrawingArea left = new DrawingArea();
^
/tmp/13923/JPanel.java:4: cannot find symbol
symbol : class DrawingArea
location: class JPanel
private DrawingArea rite = new DrawingArea();
^
/tmp/13923/JPanel.java:8: cannot find symbol
symbol : variable Color
location: class JPanel
left.setBackground(Color.white);
^
/tmp/13923/JPanel.java:9: cannot find symbol
symbol : variable Color
location: class JPanel
rite.setBackground(Color.black);
^
/tmp/13923/JPanel.java:11: cannot find symbol
symbol : class JButton
location: class JPanel
JButton changeColorBtn = new JButton("Randomize Colors");
^
/tmp/13923/JPanel.java:11: cannot find symbol
symbol : class JButton
location: class JPanel
JButton changeColorBtn = new JButton("Randomize Colors");
^
/tmp/13923/JPanel.java:12: cannot find symbol
symbol : class ActionListener
location: class JPanel
changeColorBtn.addActionListener(new ActionListener() {
^
/tmp/13923/JPanel.java:20: cannot find symbol
symbol : class BorderLayout
location: class JPanel
content.setLayout(new BorderLayout(5, 5));
^
/tmp/13923/JPanel.java:21: cannot find symbol
symbol : variable BorderLayout
location: class JPanel
content.add(changeColorBtn, BorderLayout.NORTH);
^
/tmp/13923/JPanel.java:22: cannot find symbol
symbol : variable BorderLayout
location: class JPanel
content.add(left, BorderLayout.WEST);
^
/tmp/13923/JPanel.java:23: cannot find symbol
symbol : variable BorderLayout
location: class JPanel
content.add(rite, BorderLayout.EAST);
^
/tmp/13923/JPanel.java:26: cannot find symbol
symbol : method setContentPane(JPanel)
location: class JPanel
setContentPane(content);
^
/tmp/13923/JPanel.java:27: cannot find symbol
symbol : variable EXIT_ON_CLOSE
location: class JFrame
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
^
/tmp/13923/JPanel.java:28: cannot find symbol
symbol : method setTitle(java.lang.String)
location: class JPanel
setTitle("Demo Drawing");
^
/tmp/13923/JPanel.java:29: cannot find symbol
symbol : method setLocationRelativeTo()
location: class JPanel
setLocationRelativeTo(null);
^
/tmp/13923/JPanel.java:30: cannot find symbol
symbol : method pack()
location: class JPanel
pack();
^
/tmp/13923/JPanel.java:33: cannot find symbol
symbol : class Color
location: class JPanel
return new Color((int) (Math.random() * 256), // Red
^
/tmp/13923/JPanel.java:42: cannot find symbol
symbol : method setVisible(boolean)
location: class JFrame
window.setVisible(true);
^
/tmp/13923/Inventory.java:48: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Restock Fee: " + (product.getQuantity() * product.getPrice()) * 0.05);
^
/tmp/13923/Inventory.java:50: cannot find symbol
symbol : method printIn()
location: class java.io.PrintStream
System.out.printIn();
^
28 errors
Wow, that is a ton! This is what the assignment said to do: Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee. This assignment was due Friday! I've been working on it for days now!
Here is my code:
CODE
//Stephanie Baker
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JFrame
{
public static void main( String args[] )
{
JFrame frame = new JFrame("Inventory Of Fish");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
//This is an empty content area in the frame
JLabel jlbempty = new JLabel("");
jlbempty.setPreferredSize(new Dimension(400, 400));
frame.getContentPane().add(jlbempty, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
}
CODE
public class JPanel extends JFrame {
private DrawingArea left = new DrawingArea();
private DrawingArea rite = new DrawingArea();
public JPanel() {
left.setBackground(Color.white);
rite.setBackground(Color.black);
JButton changeColorBtn = new JButton("Randomize Colors");
changeColorBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
left.setMyColor(randomColor());
rite.setMyColor(randomColor());
}
});
JPanel content = new JPanel();
content.setLayout(new BorderLayout(5, 5));
content.add(changeColorBtn, BorderLayout.NORTH);
content.add(left, BorderLayout.WEST);
content.add(rite, BorderLayout.EAST);
setContentPane(content);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Demo Drawing");
setLocationRelativeTo(null);
pack();
}
private static Color randomColor() {
return new Color((int) (Math.random() * 256), // Red
(int) (Math.random() * 256), // Green
(int) (Math.random() * 256)); // Blue
}
public static void main(String[] args) {
JFrame window = new JPanel();
window.setVisible(true);
}
}
CODE
public class Inventory extends JPanel
{
public static final int MAXIMUM_ITEMS = 10;
private static Product product[] = new Fish[MAXIMUM_ITEMS];
public static void main(String args[]) {
buildInventory();
getInventory();
}
public static void buildInventory() {
product[0] = new Fish(0, "Fancy Tailed Guppy",25, 4.99);
product[1] = new Fish(1, "Huma Huma Picasso Trigger",2, 35.99);
product[2] = new Fish(2, "Black Durgeon Trigger",1, 99.99);
product[3] = new Fish(3, "Niger Trigger",2, 45.99);
product[4] = new Fish(4, "Jack Dempsey Cichlid",4, 19.99);
product[5] = new Fish(5, "Midas Cichlid",1, 69.99);
product[6] = new Fish(6, "Neon Tetra",25, 2.99);
product[7] = new Fish(7, "Convict Cichlid",2, 15.99);
product[8] = new Fish(8, "Oscar", 4, 37.99);
product[9] = new Fish(9, "Albino Cory Cat",1, 29.99);
}
public static void getInventory() {
for(int i = 0; i < product.length; i++) {
System.out.println("Number: " + product[i].getNumber());
System.out.println("Name: " + product[i].getName());
System.out.println("Quantity: " + product[i].getQuantity());
System.out.println("Price: " + product[i].getPrice());
System.out.println("Item Value: " + product[i].getQuantity() * product[i].getPrice());
System.out.printIn("Restock Fee: " + (product[i].getQuantity() * product[i].getPrice()) * 0.05);
System.out.printf("\n%s's Inventory Total including Restocking Fee is: $%4.2f%n");
System.out.printIn();
}
}
}
If anyone would mind to help me with this, it will be greatly appreciated! Martyr2 has been excellent in helping me thus far. I have 2 more parts following this one, to completeing my program! I feel like this is the code from hell! It never ends!!! LOL
Thanks you all so very much!