Question: Lab 2: For this lab, we will learn about polymorphism and inheritance. We will be creating an abstract class called Movie, which represents any type
Lab 2: For this lab, we will learn about polymorphism and inheritance. We will be creating an abstract class called Movie, which represents any type of movie. Since this is an abstract class, we cannot instantiate it. Instead, we will create two different subclasses of Movie, ChildrensMovie and NewMove. The file FinalPracticelab2 java contains a main method that currently will not compile. This is because we have not yet created any of our classes. To make this compile, we will need to create three different classes: Movie, ChildrensMovie, and NewMovie. The Movie abstract class will contain: one data member, a String called title (you must determine what its access modifier will be) a constructor that takes one parameter (the title for the movie) a method called getTitle that takes no parameters and returns the movie's title an abstract method called getCost that takes one parameter (the number of days you will be renting the movie) . Note that an abstract class does not have a body. The body of that method is defined in the subclasses After you create the Movie abstract class, create two different subclasses (these are not abstract). The subclasses are: ChildrensMovie and NewMovie. Each of these subclasses should only have the following: . a constructor that should call the Movie class' constructor the getCost method with its body defined For a ChildrensMovie, the cost is 0.50 dollars for each day rented For a NewMovie, the cost is 1.50 dollars for each day rented o o Make sure that both of the classes are subclasses of the Movie class or this program will not compile properly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
