retail
Class CD

java.lang.Object
  extended by retail.Product
      extended by retail.CD
All Implemented Interfaces:
java.lang.Comparable

public class CD
extends Product


Field Summary
static double DEFAULT_COST
          default wholesale cost for a CD
static double DEFAULT_PRICE
          default price for a CD
static int REORDER_BATCH
          amount to re-order when re-supplying inventory
 
Fields inherited from class retail.Product
currInventory, name, sku, totalSold
 
Constructor Summary
CD()
          Creates a new default instance of CD
CD(int skuLen, java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, MusicalGenre gr)
          Creates a new instance of CD - generating an SKU of a given length randomly
CD(int skuLen, java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, java.lang.String genr)
          Creates a new instance of CD, passed genre as a string - generating an SKU of a given length randomly
CD(java.util.Scanner lineScan)
          Creates a new instance of CD given a properly positioned scanner - pointing to the appropriate place in a comma delimited string containing the name, cost, price, inventory, number sold, artist and (string representing the) genre (such as might be obtained via reading in a file that has one line per Song) Assumes info is organized in that order.
CD(java.lang.String allInfo)
          Creates a new instance of CD given a comma delimited string containing the name, cost, price, inventory, number sold, artist and (string representing the) genre (such as might be obtained via reading in a file that has one line per Song) Assumes info is organized in that order.
CD(java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, MusicalGenre gr)
          Creates a new instance of CD - generating an SKU randomly
CD(java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, java.lang.String genr)
          Creates a new instance of CD, passed genre as a string - generating an SKU randomly
CD(java.lang.String id, java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, MusicalGenre gr)
          Creates a new instance of CD
CD(java.lang.String id, java.lang.String nam, double price, double cost, int inv, int sold, java.lang.String art, java.lang.String genr)
          Creates a new instance of CD, passed genre as a string
 
Method Summary
 boolean equals(java.lang.Object toCompare)
          report whether passed object is completely equal in contents to invoking object
 java.lang.String getArtist()
          report artist name
 MusicalGenre getGenre()
          report cd genre
 java.lang.String getGenreString()
          report cd genre as a String
 boolean setArtist(java.lang.String art)
          change artist name No way to validate
 boolean setGenre(MusicalGenre gen)
          change cd genre - uses enumerated type No way to validate?
 boolean setGenre(java.lang.String gen)
          change cd genre - passing a string Make sure string corresponds to a real genre
 java.lang.String toShortString()
          create a short string representation for the CD object
 java.lang.String toString()
          create a string representation for the CD object
 
Methods inherited from class retail.Product
addInventory, buy, compareTo, getCostOfGoodsSold, getCostOfGoodsSoldOld, getCostOfGoodsStocked, getCostOfGoodsStockedOld, getCurrInventory, getName, getProfit, getProfitMargin, getProfitOld, getRetailCost, getRevenues, getRevenuesOld, getSku, getSkuString, getTotalSold, getTotalStocked, getValueOfInventory, getValueOfInventoryOld, getWholesaleCost, setName, setRetailCost, setSku, setSku, setWholesaleCost
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PRICE

public static final double DEFAULT_PRICE
default price for a CD

See Also:
Constant Field Values

DEFAULT_COST

public static final double DEFAULT_COST
default wholesale cost for a CD

See Also:
Constant Field Values

REORDER_BATCH

public static final int REORDER_BATCH
amount to re-order when re-supplying inventory

See Also:
Constant Field Values
Constructor Detail

CD

public CD()
Creates a new default instance of CD


CD

public CD(java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          MusicalGenre gr)
Creates a new instance of CD - generating an SKU randomly


CD

public CD(int skuLen,
          java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          MusicalGenre gr)
Creates a new instance of CD - generating an SKU of a given length randomly


CD

public CD(java.lang.String id,
          java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          MusicalGenre gr)
Creates a new instance of CD


CD

public CD(java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          java.lang.String genr)
Creates a new instance of CD, passed genre as a string - generating an SKU randomly


CD

public CD(int skuLen,
          java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          java.lang.String genr)
Creates a new instance of CD, passed genre as a string - generating an SKU of a given length randomly


CD

public CD(java.lang.String id,
          java.lang.String nam,
          double price,
          double cost,
          int inv,
          int sold,
          java.lang.String art,
          java.lang.String genr)
Creates a new instance of CD, passed genre as a string


CD

public CD(java.util.Scanner lineScan)
Creates a new instance of CD given a properly positioned scanner - pointing to the appropriate place in a comma delimited string containing the name, cost, price, inventory, number sold, artist and (string representing the) genre (such as might be obtained via reading in a file that has one line per Song) Assumes info is organized in that order. Scanner is updated by the Product constructor via side effects due to its being an object - it will be updated, moving on to the next item


CD

public CD(java.lang.String allInfo)
Creates a new instance of CD given a comma delimited string containing the name, cost, price, inventory, number sold, artist and (string representing the) genre (such as might be obtained via reading in a file that has one line per Song) Assumes info is organized in that order. passed scanner for its side effects - it will be updated, moving on to the next item

Method Detail

getArtist

public java.lang.String getArtist()
report artist name


getGenre

public MusicalGenre getGenre()
report cd genre


getGenreString

public java.lang.String getGenreString()
report cd genre as a String


setArtist

public boolean setArtist(java.lang.String art)
change artist name No way to validate


setGenre

public boolean setGenre(MusicalGenre gen)
change cd genre - uses enumerated type No way to validate?


setGenre

public boolean setGenre(java.lang.String gen)
change cd genre - passing a string Make sure string corresponds to a real genre


toString

public java.lang.String toString()
create a string representation for the CD object

Overrides:
toString in class Product

equals

public boolean equals(java.lang.Object toCompare)
report whether passed object is completely equal in contents to invoking object

Overrides:
equals in class Product

toShortString

public java.lang.String toShortString()
create a short string representation for the CD object