I have been working on an inventory program for school and it is all working.
What I need help now is making a GUI for it.
To display one item at a time with a buttons like First Item, Next Item, Previous Item, and Last Item.

Could someone help me with this project please. Thanks

Main Program

/**
 * Inventory Program 
 * Moved out of main and added more items
 * Added Grand Total for inventory
 * converted to look like teachers
 * Added re-stock fee per item
 * Added item cost with re-stock fee added to it
 * Added re-stock fee for each group of items
 */

public class InventoryProgram

{
        // Holding 10 items
        public static final int MAXIMUM_ITEMS = 10;
        private static Product product[] = new DVD[MAXIMUM_ITEMS];
 
        // Storing  10 items, 0-9
        public static void buildInventory() {

                product[0] = new DVD(0, "The Matrix",4, 12.0);
                product[1] = new DVD(1, "The Matrix 2",2, 13.0);
                product[2] = new DVD(2, "The Matrix 3",4, 14.);
                product[3] = new DVD(3, "The One\t",2,13.00);
                product[4] = new DVD(4, "Star Wars",4,11.0);
                product[5] = new DVD(5, "Star Wars 2",6, 12.0);
                product[6] = new DVD(6, "Star Wars 3",5, 13.00);
                product[7] = new DVD(7, "The Patriot",3, 15.0);
                product[8] = new DVD(8, "Free Willy",4, 9.0);
                product[9] = new DVD(9, "Iron Man",5,19.);
        }
                
        // Getting details of items & printing info
        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("Total Value: $"+ product[i].getQuantity() * product[i].getPrice());
                  
                 //Extra, added this to get stock fee per item
                   System.out.printf("Restock Fee per Item: $%.2f", + (product[i].getPrice()) * .05);
                   System.out.println();

                   //Extra, added this to get stock fee per item and to show what the item would cost with it added
                   System.out.printf("Item cost with Restock Fee: $%.2f", + (product[i].getPrice()) * 1.05);
                   System.out.println();
                   
                   // This line gives me the re-stock fee for each group of items, not per item.
                   System.out.printf("Restock Fee Total: $%.2f", + (product[i].getQuantity() * product[i].getPrice()) * 1.05);
                   System.out.println("\n");}//blank line for spacing
                                             
                                                
                //To get grand total of all products
                double productTotal  = 0.0;
                double totalValue = 0.0;
                         
                for ( int i = 0; i < product.length; i++) 
                {
                    productTotal  = product[i].getValue();
                    totalValue    = totalValue + productTotal;
                }
                System.out.println("");
                System.out.printf("Inventory Grand Total: \t$%.2f", + (totalValue));
        	}
        
       public static void main(String args[]) {
            buildInventory();
            getInventory();        
    }
}

Product Class

//Product Class file

public class Product {

    private String name = "";
    private int number = 0;
    private double price = 0;
    private int quantity = 0;

    public Product(int number, String name, int
quantity, double price) {
        this.number = number;
        this.name = name;
        this.quantity = quantity;
        this.price = price;
    }

    public String getName() { return name; }
    public int getNumber() { return number; }
    public double getPrice() { return price; }
    public int getQuantity() { return quantity; }

    public double getValue() {
         return (double) quantity * price;
    }
    
    public int compareTo (Object o)
    {
        String s2 = ((Product)o).name.toUpperCase();
        String s1 = name.toUpperCase();
        return ( s1.compareTo(s2) );

     } //End compareTo
    
    public String getproductDetails()
    {
        String productDetails = Integer.toString(number) + "\t" + name + "\t" + Integer.toString(quantity) + "\t\t\t" + "$" + Double.toString(price);
        return productDetails;
    }
   
}

DVD Class

//Inventory Program Part 3 Week 6 for my Java class
//DVD Class for my Inventory Program
//Breaking item types from product into their own class


public class DVD extends Product {
    
        public DVD(int number, String dvdname, int dvdquantity, double dvdprice) {
                super(number, dvdname, dvdquantity, dvdprice);
        }

    //this here can be used to get the total value of the products
    //with the 5% already added to the total value of the inventory item
    //could be used in inventory to shorten code there
    public double getValue() {
    double newPrice = super.getValue();
    return (newPrice * 1.05);
    }    
}

You will first need to work up something on it for yourself. If you run into problems, then post that code and specific questions about it.

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.