Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java using inheritence and polymorphism. 1. Create a superclass Movie with the following properties: title, year, director, and rating. This class should only have a
java using inheritence and polymorphism.
1. Create a superclass "Movie" with the following properties: title, year, director, and rating. This class should only have a parameterized constructor to initialize all the properties of the Movie. Make sure all the property data is validated before assigned to the object. Add accessor, mutator methods as needed.
2. Create subclasses "Action Movie", "Comedy Movie", and "Drama Movie" that inherit from the "Movie" class. Each subclass should have additional properties that are specific to that genre of movie. For example, the "Action Movie" class should have an additional property for the number of stunts in the movie.
3. Add appropriate constructors to the subclasses. 4. Implement the "toString()" method in each class to display the properties of the movie in a meaningful way.
5. Create a method in the "Movie" class that will return the number of movies that have been created. This method should be overridden in each subclass.
6. Create a class "MovieTester" that will test the functionality of the classes. Add a method that will display the properties of any movie object using polymorphism.
7. In the main method in the MovieTester class, Create 1 object for each subclass of Movie. Pass these objects to the method defined in Step 6 to display information about the object.
8. The application should also display the number of movies created for each subclass using the method defined in the classes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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