/* DVD.java        Authors: Koffman & Wolz
 * Class that stores DVD information.
 */
import java.io.*;

public class DVD {
  // Data fields
  private String title;
  private String category;
  private int year;
  private double time;

  // Methods
  // Constructors
  public DVD() {}
  public DVD(String titleStr, String cat, int aYear, double aTime) {
    title = titleStr;
    category = cat;
    year = aYear;
    time = aTime;
  }

  public String getTitle() {return title;}

  public String getCategory() {return category;}

  public int getYear() {return year;}

  public double getTime() {return time;}

  public String toString() {
    return  title + ", " + category + ", " + year +
           ", " + time + " hours\n";
  }

  // postcondition: writes the binary images for this object 
  //   to binary stream outs.
  public void writeDVD(DataOutputStream outs) throws IOException {
    outs.writeUTF(title);
    outs.writeUTF(category);
    outs.writeInt(year);
    outs.writeDouble(time);
  }

  // postcondition: Reads binary images from binary stream ins 
  //   into this object.
  public void readDVD(DataInputStream ins) throws IOException {
    title = ins.readUTF();
    category = ins.readUTF();
    year = ins.readInt();
    time = ins.readDouble();
  }
}
