![]() |
![]() |
![]() |
![]() |
![]() |
|
In the following program, the Movie class
definition includes a constructor
method that assigns the value 5 to all the instance variables in
Movie instances; 5 is intended to represent typical ratings
for an average movie:
public class Movie {
public int script, acting, direction;
public Movie() {
script = 5; acting = 5; direction = 5;
}
public int rating () {
return script + acting + direction;
}
}