Practice with Classes: Movie

  1. Make a Movie class and a MovieTest class.
  2. Static variables: ?
  3. Instance variables: title, ... , ?
    1. Are there default values for these?
  4. Constructors:
    1. Is a title required? Yes. Make it so using a constructor
    2. What other combination of parameters could be used to make a movie object?
  5. Static methods:
  6. Instance methods:
    Deciding which methods there are depends on the big picture of what you are doing with the movies:
    (i) possibly putting them into a playlist to play on a DVD player or video player,
    or (ii) programming a movie rental place.

To do: Make 3 or 4 movies using MovieTest.java
What would we name each Movie object?

Array lists : a nicer solution

Other useful code:

m1 = new Movie("Moonrise Kingdom");
movieCollection.add(new Movie("Wrath of Khan"));
movieCollection.add(m1);	//adds to end

//Print out the list of movies use a for-each loop
for (Movie m : movieCollection) {
    System.out.println(m.toString());
}

To do: Can you print out only the titles of the movies?

This Movie.java and MovieTest.java will not be marked -- you just have to do them and I'll comment on them and correct them. I'll be marking the next assigment on bank accounts