Java Reference
In-Depth Information
public int addStock(int incNumber)
{
currentLevel += incNumber;
return currentLevel;
}
public int removeStock(int decNumber)
{
currentLevel -= decNumber;
return currentLevel;
}
//Must supply following 'get' and 'set' methods…
//Accessor method ('get' method) for stock code…
public String code()
{
return code;
}
//Accessor method ('get' method) for stock level…
public int currentLevel()
{
return currentLevel;
}
//Mutator method ('set' method) for stock level…
public void currentLevel(int newLevel)
{
currentLevel = newLevel;
}
}
class StockItemFactoryServant
extends _StockItemFactoryImplBase
{
/*
Method to create a StockItemServant object and return
a reference to this object (allowing clients to
create StockItem objects from the servant)…
*/
public StockItem createStockItem(String newCode,
int newLevel)
{
return (new StockItemServant(newCode,newLevel));
}
}
Search WWH ::




Custom Search