/*  CLASS RECORD

DESCRIPTION:
    Stores the attributes of an item into a single record. Contains the
    item's ID number, its description, the quantity of item stored, the
    price and also location in the warehouse. Class Record also keeps
    track of the highest priced item.

--------------------------------------------------------------------------
*/
public class Record
{
    private int id;
    private String desc;
    private int quantity;
    private Location loc;
    private double price;

    private static double highPrice = 0.0;
    private static Record highPriceRec;

// ========================= default constructor =======================
    public Record()
    {
    	        // This zero arg constructor places default values when
    	        // the class Record is instantiated with no values passed
        id = 0;
        desc = "";
        quantity = 0;
        price = 0.0;
        loc = new Location();
    }

// ============================ constructor ============================
    public Record(int i, String de, int qu, double pri, Location lo)
    {
                // Reads in the item ID, item description, quantity of
                // item, price of item, and the location (object) of
                // the item
        id = i;
        desc = de;
        quantity = qu;
        price = pri;
        loc = lo;
                // Checks every new record's price to see if it's higher
                // than the previously set high price
        if(price > highPrice) { highPrice = price; highPriceRec = this; }
    }
    
            // Accessors
    public int getId() { return id; }
    public String getDescription() { return desc; }
    public int getQuantity() { return quantity; }
    public double getPrice() { return price; }
    public Location getLocation() { return loc; }
    public static Record getHighPrice() { return highPriceRec; }

            // Mutators
    public void setId(int i) { id = i;; }
    public void setDescription(String de) { desc = de;; }
    public void setQuantity(int qu) { quantity = qu; }
    public void setPrice(double pr) { price = pr; }
    public void setLoc(Location l) { loc = l; }
    
            // Prints a formatted record
    public void printRecord(String spacing)
    {
        System.out.println(spacing + "Item: " + id);
        System.out.println(spacing + "      " + desc);
        System.out.println(spacing + "      " + quantity);
        System.out.println(spacing + "      " + loc);
        System.out.println(spacing + "      " + "$" + price + "\n");
    }
    
}   // End of public class Record
