
// Item.java
// Andrew Davison, Nov 2018, ad@fivedots.coe.psu.ac.th


/**
 * The Item class represents a multi-media item.
 * Information about the item is stored and can be retrieved.
 * This class serves as a superclass for more specific itms.
 * 
 * @author Michael Kolling and David J. Barnes
 * @version 2006.03.30
 */


public class Item
{
  private String title, comment;
  private int playingTime;
  private boolean gotIt;

  public Item(String theTitle, int time)
  {
    title = theTitle;
    playingTime = time;
    gotIt = false;
    comment = null;
  }


  public void setComment(String com)
  {  comment = com; }


  public String getComment()
  {  return comment;  }


  public void setOwn(boolean ownIt)
  // set the flag indicating whether we own this item.
  {  gotIt = ownIt;  }


  public boolean getOwn()
  // return true if we own a copy of this item.
  {  return gotIt; }


  public void print()
  // print details about this item
  {
    System.out.print("title: " + title + " (" + playingTime + " mins)");
    if (gotIt)
      System.out.println("*");
    else
      System.out.println();
    if (comment != null)
      System.out.println("    " + comment);
  }  // end of print()

}  // end of Item class
