Need help creating a basic inventory program in Java

I want to create an inventory of office supplies. The product class needs to hold the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory (the number of units in stock is multiplied by the price of each unit). I am fairly new to the concept of arrays and I was wondering if anyone could help jumpstart it. The type of office supplies that I want to include are; paper, pens, pencils, erasers, and scissors.

Thanks.
pogibear77Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

contactkarthiCommented:
seems like an assgnment..

nobody at experts exchange will do the complete assignment for you. but here we will help you in completing it. post what you have done so far. we will guide you from there.

as for as arrays are concerned have a look at this url for a better understanding
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
contactkarthiCommented:
0
pogibear77Author Commented:
You're right, it is for an assignment. Sorry I wasn't able to paste what I've been working on. It takes me almost the whole entire day (including my work time) to try to even understand programming. But this is what I have so far for the inventory portion.

What do I need to do next to display the product number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory. I am guessing that I will need to write a Java application like a test program? I'm confused at this point.
// this is the class for the laptop inventory
 
import java.util.Arrays
public class Inventorylaptop
 
{
	// initializing arrays
	private int laptopNums[];
	private String laptopNames[];
	private int laptopUnits[];
	private double laptopValue[];
	private double inventoryValue[];
	
	// initializing instance variable
	private double runValue = 0;
	private double totalvalue = 0;
	private int count;
	
	public Inventorylaptop( int invNumber[], String laptopName[], int invUnits[], double invValue[] )
	
		{
			laptopNums = invNumber; // store laptop inventory
			laptopNames = laptopNames; // store laptop unique names
			laptopUnits = invUnits; // store number of laptops
			laptopValue = invValue; // store unit price for each laptops
		
		}
	
	public double calcInventoryValue()
		{
			// calculate Inventory value
			totalValue = 0; // Initialize totalValue variable
			for ( int count = 0; count < laptopNums.length; count++ )
			{	
				runValue = 0; // initialize the runValue
				runValue = ( laptopUnits[ count ] * laptopValue [ count ] );
			System.out.printf( "%s%d%s%s%s%d%s%.2f%s%.2f\n", "Item #", laptopNums[ count ], " is: ", laptopNames[ count ], " with ", laptopUnits [ count ], " units priced at $", laptopValue [ count ], " gives value of $", runValue );
				totalvalue = totalValue + runValue;
			calcTotalValue( totalvValue );
			}
				return totalValue;
		} // end calcInventoryValue method
		
		public double calcTotalValue( double totalValue )
		{
			System.out.printf( "%s%.2f\n", "The total value of the inventory is: $", totalValue );
				return totalValue;
				
		} // end calcTotalValue method
		
} // end class				
	

Open in new window

0
favorettiCommented:
Why are you passing arrays to your contructor parameters?

What you probably want it a class of LaptopInventory, with the array which will hold collection of classes for Laptop for instance. That's one approach. Another approach would be to have an array of Maps of sort to hold laptop properties. With the approach you chose it is also possible to accomplish what you want, with one condition that all parameters will allways be present and nothing will cause array indexes to shift.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.