With rating
defined to operate on Movie
instancesinstead
of on script
, acting
, and direction
valuesyou can
rewrite the program in Segment 177 as follows:
public class Demonstrate { public static void main (String argv[]) { Movie m = new Movie(); m.script = 8; m.acting = 9; m.direction = 6; System.out.print("The rating of the movie is "); System.out.println(Movie.rating(m)); } }