Help with Compile time errors
I am having trouble resolving some compile time errors that I am getting. Can anyone help? Below is the code and the error messages:
Code:
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Vector;
public class InventoryList extends Vector<Inventory>
{
public enum EPosition
{
FIRST,
PREVIOUS,
NEXT,
LAST
};
private int current = -1;
public Inventory getCurrent()
{
if ( current != -1 )
return elementAt(current);
else
return null;
}
public boolean isLast()
{
if ( current == size() - 1 )
return true;
else
return false;
}
public boolean add( Inventory item )
{
boolean result = super.add( item );
if ( result == true )
current = size() - 1;
return result;
}
public void removeCurrent()
{
if ( current >= 0 )
remove( current );
if ( current >= size() )
current = size() - 1;
}
public void setCurrent( EPosition pos )
{
if ( isEmpty() )
{
current = -1;
}
else
{
switch (pos)
{
case FIRST:
current = 0;
break;
case PREVIOUS:
current += size();
-- current;
break;
case NEXT:
++ current;
break;
case LAST:
current = size() - 1;
break;
}
current %= size();
}
}
public void replaceCurrent( Inventoryitem )
{
set( current, item );
}
public Inventory[] asArray()
{
Inventory[] items = new Inventory[size()];
return toArray(items);
}
public void write( PrintWriter pw )
{
pw.println( Inventory.getRestockingFee() );
pw.println();
for( Inventory item : this )
{
item.write( pw );
pw.println();
}
}
public void readFrom( Scanner sc )
{
clear();
Inventory.setRestockingFee( sc.nextDouble() );
while( sc.hasNextInt() )
{
int itemNumber = sc.nextInt();
sc.nextLine();
String itemName = sc.nextLine();
String sellingVenue = sc.nextLine();
int unitsInStock = sc.nextInt();
double unitPrice = sc.nextDouble();
Inventory item = new Inventory(itemNumber, itemName, sellingVenue, unitsInStock, unitPrice);
add(item);
}
}
}
.\InventoryList.java:154: <identifier> expected
public void replaceCurrent( Inventoryitem )
^
.\InventoryList.java:154: cannot find symbol
symbol : class Inventoryitem
location: class InventoryList
public void replaceCurrent( Inventoryitem )
^
.\InventoryList.java:159: cannot find symbol
symbol : method set(int,java.lang.String)
location: class InventoryList
set( current, item );
^