public class Main {
public static void main(String[] args) {
Movie myMovie = new Movie();
myMovie.name = "The Godfather";
myMovie.release = 1972;
myMovie.runningTime = 175;
myMovie.included = true;
myMovie.showProductionCredits();
myMovie.rate(7.6);
myMovie.rate(9);
myMovie.rate(10);
System.out.println(myMovie.rating);
System.out.println(myMovie.totalrating);
System.out.println(myMovie.getAverage());
}
}
public class Movie {
String name;
int release;
boolean included;
double rating;
int totalrating;
int runningTime;
void showProductionCredits(){
System.out.println("Movie: " + name);
System.out.println("Release: " + release);
System.out.println("Running time: " + runningTime);
System.out.println("On your signature: " + included);
}
void rate(double rate){
rating += rate;
totalrating++;
}
double getAverage(){
return rating/totalrating;
}
}