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

/**
 * The database class provides a facility to store CD and video 
 * objects. A list of all CDs and videos can be printed to the
 * terminal.
 * 
 * This version does not save the data to disk, and it does not
 * provide any search functions.
 * 
 * @author Michael Kolling and David J. Barnes
 * @version 2006.03.30
 */


import java.util.ArrayList;


public class Database
{
  private ArrayList<CD> cds;
  private ArrayList<DVD> dvds;


  public Database()
  { cds = new ArrayList<CD>();
    dvds = new ArrayList<DVD>();
  }


  public void addCD(CD theCD)
  {  cds.add(theCD);  }


  public void addDVD(DVD theDVD)
  {  dvds.add(theDVD);  }


  public void list()
  // print a list of all currently stored CDs and DVDs
  {
    for (CD cd : cds)
      cd.print();

    for (DVD dvd : dvds)
      dvd.print();
  }  // end of list()

}  // end of Database class
