Java Reference
In-Depth Information
LISTING 8.6
continued
//-----------------------------------------------------------------
// Name accessor.
//-----------------------------------------------------------------
public String getName()
{
return name;
}
//-----------------------------------------------------------------
// Lower bound accessor.
//-----------------------------------------------------------------
public int getLowerBound()
{
return lowerBound;
}
}
LISTING 8.7
//********************************************************************
// Movies.java Author: Lewis/Loftus
//
// Demonstrates the use of an array of objects.
//********************************************************************
public class Movies
{
//-----------------------------------------------------------------
// Creates a DVDCollection object and adds some DVDs to it. Prints
// reports on the status of the collection.
//-----------------------------------------------------------------
public static void main (String[] args)
{
DVDCollection movies = new DVDCollection();
movies.addDVD ("The Godfather", "Francis Ford Coppola", 1972, 24.95, true);
movies.addDVD ("District 9", "Neill Blomkamp", 2009, 19.95, false);
movies.addDVD ("Iron Man", "Jon Favreau", 2008, 15.95, false);
movies.addDVD ("All About Eve", "Joseph Mankiewicz", 1950, 17.50, false);
movies.addDVD ("The Matrix", "Andy & Lana Wachowski", 1999, 19.95, true);
Search WWH ::




Custom Search