Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an item number one more than the previous last item.

Add a Save button to the GUI that saves the inventory to a C:\data\inventory.dat file.

Use exception handling to create the directory and file if necessary.

Add a search button to the GUI that allows the user to search for an item in the inventory by the product name. If the product is not found, the GUI should display an appropriate message. If the product is found, the GUI should display that product’s information in the GUI.

import javax.swing.JOptionPane;

class cd{
	public static void main(String[]args) {
	}
	 public cd(int i, String string) {
		// TODO Auto-generated constructor stub
	}

	public cd(Object println) {
		// TODO Auto-generated constructor stub
	}
	
	public static void main(String args) {
	       
         cd cd = new cd (4, args);


         
         cd = new cd (1, "Sevens");
         System.out.println(cd);

         cd = new cd(2, "Beyond the Season");
         System.out.println(cd);

         cd = new cd(3, "Fresh Horses");
         System.out.println(cd);

         cd = new cd(4, "Scarecrow");

         System.out.println("Title of cd is " + cd.cdtitle());
         System.out.println("Units in stock is " + cd.cdunits());
         System.out.println("How much the price of cd is " + cd.cdprice());
         System.out.println("Value of inventory is " + cd.cdinventory());
      }private String cdinventory() {
		// TODO Auto-generated method stub
		return null;
	}

	String cdprice() {
		// TODO Auto-generated method stub
		return null;
	}

	//end main

	String cdunits() {
		// TODO Auto-generated method stub
		return null;
	}

	String cdtitle() {
		// TODO Auto-generated method stub
		return null;
	}// end class cd 

}
public class CdInventory 
{
	public static void main( String args [ ])
    {
         
            cd[] cdcollection = new cd [10]
		    // Please enter cdTitle
            		
            String cdTitle = JOptionPane.showInputDialog("Please enter CD Title or quit the program:");
            
             

         
         
         System.out.println("Cd inventory"); 
         Object product;
		System.out.printf( "%s %s\n", "Cd Title:",
              ((Object) product).cdtitle() );
          System.out.printf( "%s %d\n", "Units Available:",
              ((Object) product).cdunits() );
          System.out.printf( "%s $%g\n", "Price Per Unit:",
              ((Object) product).cdprice() );

    } // end main method

} // end class CarsInventory

I am looking for help with this. I have been fighting this course for the past nine weeks and do not understand. I have went to my instructor which did me no good. I have looked at YouTube videos, read the required materials, and using Eclipse. I do not know what to do now that my Final is due is four hours and do not understand how to do it.

So I have managed to get this far if anyone would like to help me out I would greatly appreciate any help.

import javax.util.arrays;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class cd{
    public static void main(String[]args) {
    }
     public cd(int i, String string) {
        // TODO Auto-generated constructor stub
    }

    private String cdTitle;
    private int cdStock;
    private float cdPrice;
    private float cdRestockfee;



    cd(String cdTitle, int cdStock, private float cdPrice)
        this.cdTitle = title;
        this.cdStock = stock;
        this.cdPrice = price;

    public String getcdTitle() {return title};
    public int getcdStock() {return stock};
    public float getcdPrice() {return price};
    public float getcdRestockfee() {return restock fee};

    return cdStock * cdPrice;




        cd cd = new cd (4, args);



         cd = new cd (1, "Sevens");
         System.out.println(cd);

         cd = new cd(2, "Beyond the Season");
         System.out.println(cd);

         cd = new cd(3, "Fresh Horses");
         System.out.println(cd);

         cd = new cd(4, "Scarecrow");

         System.out.println("Title of cd is " + cd.cdtitle());
         System.out.println("Units in stock is " + cd.cdunits());
         System.out.println("How much the price of cd is " + cd.cdprice());
         System.out.println("Value of inventory is " + cd.cdinventory());
      }private String cdinventory() {
        // TODO Auto-generated method stub
        return null;
    }

    String cdprice() {
        // TODO Auto-generated method stub
        return null;
    }

    //end main

    String cdunits() {
        // TODO Auto-generated method stub
        return null;
    }

    String cdtitle() {
        // TODO Auto-generated method stub
        return null;
    }// end class cd 

}






public class CdInventory<Cd> 
{

 private Cd = cd;
 private int cdCount;

 cd = new cd[4];
 cdCount = 0

 public int getcdCount() {return cdCount};
 public Cd getCd(int)() {return cd};

 public void addCd (cd) {
 cd[cdCount] = cd;
 ++cdCount;

  public double value() {
     double totalInventory = 0;

  for (int i = 0; i < cdCount; i++);
  Object[] count;
int i;
cdCount += ((CdInventory) count[i]).value();
  }

 System.out.println("Cd Inventory");

  }






import java.awt.Container;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;


public class GUI_Inventory_Extends_JFrame {

}

private Inventory = inventory;

private int = 0;

private final JLabel cdTitleLabel = new JLabel ("Title");
private JTextField cdTitle;

private final JLabel cdStockLabel = new JLabel ("How many cds are in stock");
private JTextField cdStock;

private final JLabel cdPriceLabel = new JLabel ("Price of cd");
private JTextField cdPrice;

private final JLabel cdTotalLabel = new JLabel ("Total");
private JTextField cdTotalLabel;

private final JLabel cdRestockfeeLabel - new JLabel ("Restocking Fee");
private JTextField cdRestockfeeLabel;

private JPanel = centralPanel;
private JPanel = buttonPanel;


GUIinventory {
    super("cd Inventory");

    JButton fButton = new JButton("First Button");
    Container buttonPanel;
    buttonPanel.add(buttonPanel, "First Button");

    JButton pButton = new JButton("Previous Button");
    buttonPanel.add(buttonPanel, "Previous Button");

    JButton aButton = new JButton ("Add Button");
    buttonPanel.add("Add Button");

    JButton sButton = newJButton("Save Button");
    buttonPanel.add("Save Button");

    centeralPanel.add(buttonPanel);




}

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.