Waaah, i got a project, but I can't get it write,
i'm not bad at programming but,it's just happen my professor is really busy.
teaching is just his part-time job.

I can remember we stop the discussion somewhere introducing objects..
but haven't really discussed about things

lets go back to the program, our project is to create a simple sales and inventory program.
the products are declared, we don't need a database,
here are the elements
item ID, item Name, item Brand(dunno what's this for?), item price, item stock amt.

the program will execute a menu on it's first run
1. List Products
2. Purchase Item
3. Add stock
4. exit

i'm currently working on it, but i really do not understand what I am doing.
i've read a couple of example codes, but i really can't understand 'em..

here is my code as of this moment..

here is my main class

package inventoryproject;
import java.util.Scanner;
public class InventoryProject {
    public static void showMenu() {
        System.out.println("1. List Products");
        System.out.println("2. Purchase Products");
        System.out.println("3. Add Stock");
        System.out.println("4. Exit");
    }
    public static void listMe() {
        Item prodOne = new Item();
        Item prodTwo = new Item();
        prodOne.itemList(1, "Boy Bawang", "MyFoods", 1.50, 10);
        prodTwo.itemList(2, "ChicharonKo", "JunkMeNow", 5.00, 10);
        prodOne.printMe();
        prodTwo.printMe();
    }
    public static void sellMe() {
        System.out.println("Enter the ProductId of the Item you want to sell.");
        Scanner sc = new Scanner(System.in);
        int select = sc.nextInt();
        prod
    }
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int select=1;
       while(select!=4){
           System.out.println("What do you want to do?");
           showMenu();
           select = sc.nextInt();
           switch(select){
               case 1 :
                   listMe();
                   break;
               case 2:
                   sellMe();
                   break;
               case 3:
                   break;
               case 4:
                   break;
                    
           }
       }
    }
    
}

and here is the Item class

package inventoryproject;
public class Item {
    public int prodId;
    public String prodName;
    public String prodBrand;
    public double prodPrice;
    public int prodStocks;
    
    // init them
    
    public void itemList(int prodId, String prodName, String prodBrand, double
            prodPrice, int prodStocks) {
        this.prodBrand = prodBrand;
        this.prodId = prodId;
        this.prodName = prodName;
        this.prodPrice = prodPrice;
        this.prodStocks = prodStocks;
    }
    
    public void printMe() {
        System.out.println(prodId + "\t | \t " + prodName + "\t | \t " + prodBrand + "\t | \t "
                + prodPrice + "\t | \t " + prodStocks);
    }
    public int getItemStock() {
        return prodStocks;
    }
    
}

wonder if you can help me out..

thank you!

Recommended Answers

All 2 Replies

Ask specific questions.

what's wrong with my code,
what should i do next..

i've been reading stuffs in 5 days..i can't get this to work..
sorry

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.