QUOTE(Martyr2 @ 30 Sep, 2008 - 09:34 PM)

You have lots of issues here. The biggest one is your naming scheme here. Why do you have a class called "inventory" extending from product? Inventory should be the the class that wraps around an array of products. Here is the hierarchy...
1) Define a product class
2) Extend the product as a specific type of product (aka a DVD, movie etc)
3) You have an inventory class that CONTAINS an array of product classes and has methods to accessing those products including "add" and "getInventoryValue" which would return the sum of all product values.
4) Your GUI will then interact with the inventory class so that buttons call the individual methods of the inventory class. An "add" button would collect data and give it to the inventory class' "add" method.
So what I am seeing in the main method here (defining of the product array, calculating of the inventory value etc) should be done inside the inventory class. The main function should contain...
1) Defining a variable of the type "inventory"
2) Creating your GUI (whether it be the controls directly or a GUI class)
3) Events of that GUI being attached to the methods of the inventory class.
So where to start? I would start by checking out my blog at the link below....
Martyr2's Programming Underground - Parts 1-3 of Product/Inventory ProjectI would look at part 3 in particular where I create the inventory class and you will notice how I create an array of products called "items" and then I introduce an "add" function which will add products to the array. I also have a function called getTotalInvValue() which gets the total value of all products in the array and returns the sum.
Make sure that your inventory portion is completed before moving onto the GUI because your GUI is going to rely on this class to make sure it works properly. Without it being proper, your GUI is going to face a bunch of problems.
Hope that helps.

QUOTE(Martyr2 @ 30 Sep, 2008 - 09:34 PM)

You have lots of issues here. The biggest one is your naming scheme here. Why do you have a class called "inventory" extending from product? Inventory should be the the class that wraps around an array of products. Here is the hierarchy...
1) Define a product class
2) Extend the product as a specific type of product (aka a DVD, movie etc)
3) You have an inventory class that CONTAINS an array of product classes and has methods to accessing those products including "add" and "getInventoryValue" which would return the sum of all product values.
4) Your GUI will then interact with the inventory class so that buttons call the individual methods of the inventory class. An "add" button would collect data and give it to the inventory class' "add" method.
So what I am seeing in the main method here (defining of the product array, calculating of the inventory value etc) should be done inside the inventory class. The main function should contain...
1) Defining a variable of the type "inventory"
2) Creating your GUI (whether it be the controls directly or a GUI class)
3) Events of that GUI being attached to the methods of the inventory class.
So where to start? I would start by checking out my blog at the link below....
Martyr2's Programming Underground - Parts 1-3 of Product/Inventory ProjectI would look at part 3 in particular where I create the inventory class and you will notice how I create an array of products called "items" and then I introduce an "add" function which will add products to the array. I also have a function called getTotalInvValue() which gets the total value of all products in the array and returns the sum.
Make sure that your inventory portion is completed before moving onto the GUI because your GUI is going to rely on this class to make sure it works properly. Without it being proper, your GUI is going to face a bunch of problems.
Hope that helps.

QUOTE(Martyr2 @ 30 Sep, 2008 - 09:34 PM)

You have lots of issues here. The biggest one is your naming scheme here. Why do you have a class called "inventory" extending from product? Inventory should be the the class that wraps around an array of products. Here is the hierarchy...
1) Define a product class
2) Extend the product as a specific type of product (aka a DVD, movie etc)
3) You have an inventory class that CONTAINS an array of product classes and has methods to accessing those products including "add" and "getInventoryValue" which would return the sum of all product values.
4) Your GUI will then interact with the inventory class so that buttons call the individual methods of the inventory class. An "add" button would collect data and give it to the inventory class' "add" method.
So what I am seeing in the main method here (defining of the product array, calculating of the inventory value etc) should be done inside the inventory class. The main function should contain...
1) Defining a variable of the type "inventory"
2) Creating your GUI (whether it be the controls directly or a GUI class)
3) Events of that GUI being attached to the methods of the inventory class.
So where to start? I would start by checking out my blog at the link below....
Martyr2's Programming Underground - Parts 1-3 of Product/Inventory ProjectI would look at part 3 in particular where I create the inventory class and you will notice how I create an array of products called "items" and then I introduce an "add" function which will add products to the array. I also have a function called getTotalInvValue() which gets the total value of all products in the array and returns the sum.
Make sure that your inventory portion is completed before moving onto the GUI because your GUI is going to rely on this class to make sure it works properly. Without it being proper, your GUI is going to face a bunch of problems.
Hope that helps.
