|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object retail.Product
public class Product
Field Summary | |
---|---|
protected int |
currInventory
current inventory |
protected java.lang.String |
name
name of the product |
protected id.ID |
sku
uniquely identifies a given product |
protected int |
totalSold
number sold |
Constructor Summary | |
---|---|
Product()
Creates a new default instance of Product |
|
Product(int skuLen,
java.lang.String nam,
double price,
double cost,
int inv,
int sold)
constructor with all info but ID supplied (id will be generated as a random code length passed). |
|
Product(java.util.Scanner scan)
Creates a new instance of Product given a properly positioned scanner - pointing to the appropriate place in a comma delimited string containing the name, cost, price, inventory and number sold (such as might be obtained via reading in a file that has one line per Product) Assumes info is organized in that order. |
|
Product(java.lang.String allInfo)
Creates a new instance of Product given a comma delimited string containing the name, cost, price, inventory and number sold (such as might be obtained via reading in a file that has one line per Song) Assumes info is organized in that order. |
|
Product(java.lang.String nam,
double price,
double cost,
int inv,
int sold)
constructor with all info but ID supplied (id will be generated as a random 6 long code). |
|
Product(java.lang.String id,
java.lang.String nam,
double price,
double cost,
int inv)
constructor with all info except number sold supplied (id as a String). |
|
Product(java.lang.String id,
java.lang.String nam,
double price,
double cost,
int inv,
int sold)
constructor with all info supplied (id as a String). |
Method Summary | |
---|---|
boolean |
addInventory(int number)
we buy more inventory |
boolean |
buy(int number)
somebody buys from us |
int |
compareTo(java.lang.Object obj)
Compares two Products - needed for sorting - required since implements Comparable interface returns negative if object comparing to is less, zero if object comparing to is equal, positive if object comparing to is greater. |
boolean |
equals(java.lang.Object toCompare)
report whether passed object is completely equal in contents to invoking object |
double |
getCostOfGoodsSold()
obtain the cost of goods sold (for accountants) |
double |
getCostOfGoodsSoldOld()
don't use |
double |
getCostOfGoodsStocked()
obtain the cost of all goods stocked (sold and unsold) |
double |
getCostOfGoodsStockedOld()
don't use |
int |
getCurrInventory()
obtain the current inventory |
java.lang.String |
getName()
report product name |
double |
getProfit()
obtain the revenues brought in |
double |
getProfitMargin()
report our profit margin for any one of these |
double |
getProfitOld()
don't use |
double |
getRetailCost()
report our customer's cost |
double |
getRevenues()
obtain the revenues brought in |
double |
getRevenuesOld()
obtain the revenues brought in |
id.ID |
getSku()
report SKU |
java.lang.String |
getSkuString()
report SKU as String |
int |
getTotalSold()
obtain the current number sold |
int |
getTotalStocked()
obtain the number stocked (sold or unsold) |
double |
getValueOfInventory()
obtain the cost of current inventory |
double |
getValueOfInventoryOld()
don't use |
double |
getWholesaleCost()
report our cost |
boolean |
setName(java.lang.String nam)
change value for name Currently no validation |
boolean |
setRetailCost(double price)
change value for customer cost Must be positive and greater than wholesale cost |
boolean |
setSku(id.ID sk)
change value for SKU - passed an ID Currently no validation - but I'm sure there should be rules |
boolean |
setSku(java.lang.String sk)
change value for SKU - passed a String Currently no validation - but I'm sure there should be rules |
boolean |
setWholesaleCost(double cost)
change value for our cost Must be positive |
java.lang.String |
toString()
create a string representation for the Product object |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected id.ID sku
protected java.lang.String name
protected int currInventory
protected int totalSold
Constructor Detail |
---|
public Product()
public Product(java.lang.String nam, double price, double cost, int inv, int sold)
public Product(int skuLen, java.lang.String nam, double price, double cost, int inv, int sold)
public Product(java.lang.String id, java.lang.String nam, double price, double cost, int inv, int sold)
public Product(java.lang.String id, java.lang.String nam, double price, double cost, int inv)
public Product(java.lang.String allInfo)
public Product(java.util.Scanner scan)
Method Detail |
---|
public id.ID getSku()
public java.lang.String getSkuString()
public java.lang.String getName()
public double getRetailCost()
public double getWholesaleCost()
public int getCurrInventory()
public int getTotalSold()
public double getProfitMargin()
public int getTotalStocked()
public double getValueOfInventory()
public double getValueOfInventoryOld() throws ProductNotKnownException
ProductNotKnownException
public double getCostOfGoodsSold()
public double getCostOfGoodsSoldOld() throws ProductNotKnownException
ProductNotKnownException
public double getCostOfGoodsStocked()
public double getCostOfGoodsStockedOld() throws ProductNotKnownException
ProductNotKnownException
public double getRevenues()
public double getRevenuesOld() throws ProductNotKnownException
ProductNotKnownException
public double getProfit()
public double getProfitOld() throws ProductNotKnownException
ProductNotKnownException
public boolean setSku(id.ID sk)
public boolean setSku(java.lang.String sk)
public boolean setName(java.lang.String nam)
public boolean setRetailCost(double price)
public boolean setWholesaleCost(double cost)
public boolean buy(int number)
public boolean addInventory(int number)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object toCompare)
equals
in class java.lang.Object
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |