Create an abstract class called Movie. The class should declare the following variables: an instance variable that describes the title - String an instance variable that describes the rating - double an instance variable that describes the director - String an instance variable that describes the genre - String an instance variable that describes the year – integer an instance variable that describes the language – String an instance variable that describes the ticket price - double Create the getter and setter methods for each instance variable except setter for ticket price and getter for genre. Create the necessary constructors. Include an abstract method setTicketPrice(double ticketPrice) to determine the ticket price for a movie. Include an abstract method getGenre() to return the genre of the movie. Provide a toString() method that returns the information stored in the above variables. Create three subclasses called ThrillerMovie, ComedyMovie, and ChildrenMovie. These subclasses should override the abstract methods setTicketPrice and getGenre of class Movie. Use the following rule for setting the ticket price for a movie: Children movies will have a 10% discount Thriller movies will have a fixed price (specified by user) Comedy movies will have a 5% discount Write a driver program (another class with main method) that uses the above hierarchy. In your driver program you must implement an interaction with the user. Use showInputDialog method to let the user input movie information. Use showMessageDialog method to display movie information including price and type for movies.
Create an abstract class called Movie. The class should declare the following variables:
- an instance variable that describes the title - String
- an instance variable that describes the rating - double
- an instance variable that describes the director - String
- an instance variable that describes the genre - String
- an instance variable that describes the year – integer
- an instance variable that describes the language – String
- an instance variable that describes the ticket price - double
Create the getter and setter methods for each instance variable except setter for ticket price and getter for genre. Create the necessary constructors. Include an abstract method setTicketPrice(double ticketPrice) to determine the ticket price for a movie. Include an abstract method getGenre() to return the genre of the movie. Provide a toString() method that returns the information stored in the above variables.
Create three subclasses called ThrillerMovie, ComedyMovie, and ChildrenMovie.
These subclasses should override the abstract methods setTicketPrice and getGenre of class Movie.
Use the following rule for setting the ticket price for a movie:
- Children movies will have a 10% discount
- Thriller movies will have a fixed price (specified by user)
- Comedy movies will have a 5% discount
Write a driver program (another class with main method) that uses the above hierarchy. In your driver program you must implement an interaction with the user.
- Use showInputDialog method to let the user input movie information.
- Use showMessageDialog method to display movie information including price and type for movies.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images