Write a java code to create a Movie class to hold information about Movies; Attributes are Movies name Length of the movie Rating You can
Write a java code to create a Movie class to hold information about Movies; Attributes are
Movies name
Length of the movie
Rating
You can define other attributes if you need in your design
Your code should have at least one Specific Constructor.
public Movie(String movieName, int length)
Movie object should have the following Methods:
a)Required get/set methods
b )Methods newRating that accepts an integer as rating and calculates the overall rating of the movie.
c ) Display methods to print the movie information on the console.
Sample run 1:
Rate gone with the wind: 5
Rate gone with the wind: 3
Rate gone with the wind: 2
Rate gone with the wind: 5
Rate gone with the wind: 4
Movie information:
Movie name: gone with the wind
Length: 238
Rating: 3.8
Enter the name of the next movie: The Good, the Bad and the Ugly
Enter the length of the movie: 161
Rate The Good, the Bad and the Ugly: 5
Rate The Good, the Bad and the Ugly: 5
Rate The Good, the Bad and the Ugly: 1
Rate The Good, the Bad and the Ugly: 2
Rate The Good, the Bad and the Ugly: 3
Movie information:
Movie name: The Good, the Bad and the Ugly
Length: 161
Rating: 3.2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started