I have this code i compile it and it ran but nothing came up can someone help with this?
import java.util.Arrays;
import java.util.Comparator;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
class Camera{
public static void main(String[] args){
}
private int itemNumber;
private String productName;
private int unitsInStock;
private double price;
public Camera() {
}
public Camera(int itemNumber, String productName, int unitsInStock,
double price, String supplierName) {
this.itemNumber = itemNumber;
this.productName = productName;
this.unitsInStock = unitsInStock;
this.price = price;
}
public double calculateInventory() {
return this.unitsInStock * this.price;
}
public int getItemNumber() {
return itemNumber;
}
public String getProductName() {
return productName;
}
public int getUnitsInStock() {
return unitsInStock;
}
public double getPrice() {
return price;
}
public void setItemNumber(int itemNumber) {
this.itemNumber = itemNumber;
}
public void setName(String productName) {
this.productName = productName;
}
public void setUnitsInStock(int unitsInStock) {
this.unitsInStock = unitsInStock;
}
public void setPrice(double price) {
this.price = price;
{
}
}
}class Supplier extends Camera {
private String supplierName;
public Supplier(int itemNumber, String productName, int unitsInStock,
double price, String supplierName) {
super(itemNumber, productName, unitsInStock, price);
this.supplierName = supplierName;
}
public double calculateRestockFee() {
return super.calculateInventory() * .05;
}
public double calculateInventory() {
return super.calculateInventory() + calculateRestockFee();
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public class InventoryPart5 extends JFrame {
private DecimalFormat currency = new DecimalFormat("$#,##0.00");
private JTextField itemNumberTF;
private JTextField productNameTF;
private JTextField unitsInStockTF;
private JTextField priceTF;
private JTextField supplierNameTF;
private JTextField restockFeeTF;
private JTextField valueOfInventoryTF;
private JTextField totalValueOfInventoryTF;
private JButton FirstBT;
private JButton BackBT;
private JButton nextBT;
private JButton lastBT;
private Supplier[] products;
private int current = 0;
public InventoryPart5() {
super("Inventory Part 5");
setSize(600, 300);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
products = new Supplier[5];
products[0] = new Supplier(500, "STYLUS", 10, 800, "Olympus");
products[1] = new Supplier(200, "COOLPIX", 20, 650, "Nikon");
products[2] = new Supplier(300, "Powershot", 15, 890, "Canon");
products[3] = new Supplier(350, "Cyber-shot", 10, 1200, "Sony");
products[4] = new Supplier(400, "Easyshare", 80, 1500, "Kodak");
sortArray();
createComponents();
setVisible(true);
updateFields();
}
private void createComponents() {
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
p.add(createFieldsPanel(), BorderLayout.CENTER);
p.add(createButtonsPanel(), BorderLayout.SOUTH);
setContentPane(p);
}
private JPanel createButtonsPanel() {
JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.LEFT));
ImageIcon icon = new ImageIcon ("CameraShopLogo.jpg");
JLabel label = new JLabel();
label.setIcon(icon);
p.add(label);
this.getContentPane().add(p);
FirstBT = new JButton("First");
FirstBT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
current = 0;
updateFields();
}
});
p.add(FirstBT);
BackBT = new JButton("Back");
BackBT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (current > 0) {
current--;
updateFields();
}
}
});
p.add(BackBT);
nextBT = new JButton("Next");
nextBT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (current < products.length - 1)
current++;
updateFields();
}
});
p.add(nextBT);
lastBT = new JButton("Last");
lastBT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
current = products.length-1;
updateFields();
}
});
p.add(lastBT);
return p;
}
protected void updateFields() {
Supplier s = products[current];
itemNumberTF.setText(String.valueOf(s.getItemNumber()));
productNameTF.setText(s.getProductName());
unitsInStockTF.setText(String.valueOf(s.getUnitsInStock()));
priceTF.setText(currency.format(s.getPrice()));
supplierNameTF.setText(s.getSupplierName());
restockFeeTF.setText(currency.format(s.calculateRestockFee()));
valueOfInventoryTF.setText(currency.format(s.calculateInventory()));
totalValueOfInventoryTF.setText(currency.format(calculateInventory()));
}
private JPanel createFieldsPanel() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(0, 2, 5, 5));
p.add(new JLabel("Item Number"));
itemNumberTF = new JTextField();
p.add(itemNumberTF);
p.add(new JLabel("Product Name"));
productNameTF = new JTextField();
p.add(productNameTF);
p.add(new JLabel("Units In Stock"));
unitsInStockTF = new JTextField();
p.add(unitsInStockTF);
p.add(new JLabel("Unit Price"));
priceTF = new JTextField();
p.add(priceTF);
p.add(new JLabel("Supplier Name"));
supplierNameTF = new JTextField();
p.add(supplierNameTF);
p.add(new JLabel("Restock Fee"));
restockFeeTF = new JTextField();
p.add(restockFeeTF);
p.add(new JLabel("Value Of Inventory"));
valueOfInventoryTF = new JTextField();
p.add(valueOfInventoryTF);
p.add(new JLabel(""));
p.add(new JLabel(""));
p.add(new JLabel("Value Of The Entire Inventory"));
totalValueOfInventoryTF = new JTextField();
p.add(totalValueOfInventoryTF);
return p;
}
public double calculateInventory() {
double value = 0;
for (int i = 0; i < products.length; i++) {
value += products[i].calculateInventory();
}
return value;
}
public void sortArray() {
int n = products.length;
boolean swapped;
do {
swapped = false;
for (int i = 0; i < n - 1; i++) {
String name1 = products[i].getProductName();
String name2 = products[i + 1].getProductName();
if (name1.compareToIgnoreCase(name2) > 0) {
Supplier temp = products[i];
products[i] = products[i + 1];
products[i + 1] = temp;
swapped = true;
}
}
n = n - 1;
} while (swapped);
}
}
}