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

/**
 * The CD class represents a CD object. Information about the 
 * CD is stored and can be retrieved.
 * 
 * @author Michael Kolling and David J. Barnes
 * @version 2006.03.30
 */


public class CD
{
  private String title, artist, comment;
  private int numberOfTracks, playingTime;
  private boolean gotIt;


  public CD(String theTitle, String theArtist, int tracks, int time)
  {
    title = theTitle;
    artist = theArtist;
    numberOfTracks = tracks;
    playingTime = time;
    gotIt = false;
    comment = null;
  }  // end of CD()


  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 CD.
  {  gotIt = ownIt;  }


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


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

}  // end of CD class
