Help calling class inventory
I am writing a program for inventory. I have my inventoryMain.java file, then wrote another file called inventory.java. I cant figure out how to get my main to call the other inventory file. Every inventory class in my main has an error. My inventory.java file compiles with no problem it is listed at bottom of inventorymain.java
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
publicclass inventoryMain
{
// main method begins execution of java application
publicstaticvoid main(String[] args)
{
//create inventory of pens
inventory pens =new inventory();//creating the inventory with empty constructor
pens.setItemNum( 1 );
pens.setName("pens" );
pens.setPrice( 1.5 );
pens.setUnits( 346 );
//create inventory of pencils
inventory pencils =new inventory();//creating the inventory with empty constructor
pencils.setItemNum( 2 );
pencils.setName("pencils" );
pencils.setPrice( .59 );
pencils.setUnits( 487 );
//create inventory of markers
inventory markers =new inventory();//creating the inventory with empty constructor
markers.setItemNum( 3 );
markers.setName("markers" );
markers.setPrice( 1.39 );
markers.SetUnits( 168 );
//create inventory of paperclips
inventory paperclips =new inventory();//creating the inventory with empty constructor
paperclips.setItemNum( 4 );
paperclips.setName("paperclips" );
paperclips.setPrice( 1.0 );
paperclips.setUnits( 136 );
//create inventory of glue
inventory glue =new inventory();//creating the inventory with empty constructor
glue.setItemNum( 5 );
glue.setName("glue" );
glue.setPrice( .79 );
glue.setUnits( 72 );
//create inventory of tape
inventory tape =new inventory();//creating the inventory with empty constructor
tape.setItemNum( 6 );
tape.setName("tape" );
tape.setPrice( .49 );
tape.setUnits( 127 );
//create inventory of paper
inventory paper =new inventory();//creating the inventory with empty constructor
paper.setItemNum( 7 );
paper.setName("paper" );
paper.setPrice( 1.79 );
paper.setUnits( 203 );
//Display the inventories
pens.showInventory();
pencils.showInventory();
markers.showInventory();
paperclips.showInventory();
glue.showInventory();
tape.showInventory();
paper.showInventory();
}//end main
}//end class inventoryMain
_
publicclass inventory
{
privateint itemNum;
private String name =new String();
privateint units;
privatedouble price;
//All getters and setters
publicint getItemNum()
{
return itemNum;
}
publicvoid setItemNum(int itemNum)
{
this.itemNum = itemNum;
}
public String getName()
{
return name;
}
publicvoid setName(String name)
{
this.name = name;
}
publicint getUnits()
{
return units;
}
publicvoid setUnits(int units)
{
this.units = units;
}
publicdouble getPrice()
{
return price;
}
publicvoid setPrice(double price)
{
this.price = price;
}
//Constructors
inventory()// Empty Constructor
{
}
//Constructor that takes arguments
inventory(int _itemNum, String _name,int _units,double _price)//Constructor
{
itemNum = _itemNum;
name = _name;
units = _units;
price = _price;
}
//Computes value of inventory
publicdouble valueOfInventory()
{
return price * units;
}
//displays the details of the inventory
publicvoid showInventory()
{
System.out.println("Product Name: "+name);
System.out.println("Item Number: "+itemNum);
System.out.println("Number of Units: "+units);
System.out.println("Unit Price: "+price);
//call the valueOfInventory() method and display the value
System.out.println("The value of the inventory of "+name+" is = "+valueOfInventory());
}
}

