Hello All,
I am submitting a inventory program that I need some help with.
I had to create a product class that holds the item number, the name of the product, the number of units in stock, and the price of each unit.
Then I needed to create a java app that would display the product number, the name of the product, the number of units in stock, the price of the units, and the value of the inventory (number of units * price of each)
I would appreciate it if someone could look over what I have done and make suggestions I am new at this and appreciate the help...
//InventoryProgram1.Java
//import java.util.Scanner; // allow for input
import java.util.Arrays;
import java.util.Scanner;
class Product {
String name;
int item number;
int number of units;
int price per unit;
public Product (String name, int item number, int number of units, int price per unit)
{
this.name = name;
this.item number = item number;
this.numberofunits = units;
this.priceperunit = price;
computeValueInventory ();
}
private void computeValueInventory () {
Value = Units * price;
}
public int getValueInventory () {
return ValueInventory;
}
}
public class InventoryProgram1 //declares public class inventory
{
public static void main(String args []) //starts the program
{
Scanner input = new Scanner( System.in );
Stapler[] stapler= new Stapler[1];
stapler[0] = new Stapler( 645, "Black", 2, 17.99 );//declares a new item number,
color, quantity, and price
}
{
System.out.println(Stapler[i]);
System.out.println();
System.out.println("The item number is " + stapler[i].getItemNumber());
System.out.println("Product Title is " + stapler[i].getstaplercolor());
System.out.println("The number of units in stock is " +
stapler[i].getOnHand());
System.out.println("The price of each stapler is " +
stapler[i].getstaplerCost());
System.out.println("The value of the inventory is " + stapler[i].value());
}
}//end class
} // end class Inventory1