Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create an interactive Java application that implements a class called Movie, a class derived from Movie called AwardWinningMovie, and a driver to demonstrate the

1. Create an interactive Java application that implements a class called Movie, a class derived from Movie called AwardWinningMovie, and a driver to demonstrate the functionality of the two classes. Implementation specifics are described below. As usual, your program output should resemble the sample runs at the end of this document.

Implementation Requirements: Part 1. Create a superclass called Movie that represents a movie. Required attributes include title, rating, genre, director, and star. For example, an object of type Movie called starTrekMovie could have attributes Star Trek into Darkness (title), PG-13 (rating), Sci-fi (genre), J.J. Abrams (director), and Chris Pine (star). Implement the Movie class according to the following specification: Five private instance variables that represent title (type String), rating (type String), genre (type String), director (type String), and star (type String). A five-argument constructor that initializes the five instance variables. set and get methods for each of the five instance variables. An equals method that compares two Movie objects for equality and returns a boolean value. A toString method that generates nicely formatted output of the Movie attributes. (Note: Your toString method must override the toString method of class Object.)

Part 2. Create a subclass of Movie called AwardWinningMovie with two additional attributes, award title and award year. For example, Star Trek into Darkness won the ASCAP Award for Top Box Office Films (award title) in 2014 (award year).) Implement the AwardWinningMovie class according to the following specification: Private instance variables awardTitle (type String) and awardYear (type int). A seven-argument constructor that initializes the seven instance variables. (Hint: Start by using the superclass constructor to initialize the inherited instance variables.) set and get methods for each of the two additional instance variables. An equals method that compares two AwardWinningMovie objects for equality and returns a boolean value. A toString method that generates nicely formatted output of all of the AwardWinningMovie attributes.

Part 3. Create an interactive driver to test your program. The driver begins by creating a database of a minimum of 10 AwardWinningMovie objects. (Implement the database using an array or an ArrayList.) It then provides the user with two options: display the award-winning movies alphabetically by title, or display the award-winning movies alphabetically by genre. Next, it prompts the user to select a movie to obtain more information about. Please note that the driver must validate the users input. Specifically, it must use exception handling (try-catch block) in combination with one or more loops to deal with the possible entry of non-integer values as well as the entry of out-of-range values. Once the input has been validated, the driver displays the requested information about the movie. Finally, the driver asks the user if s/he would like to obtain information about another movie. If the user enters Y, the program continues; otherwise, it thanks the user for using the experimental database and ends.

Implement a search option. Specifically, provide the user with the option to search the experimental database by one of the AwardWinningMovie attributes (title, genre, star, etc.)

Sample run #1: run: EXPERIMENTAL AWARD-WINNING MOVIE DATABASE* ----------------------------------------- (*Funded in part by IMDb.com) Movie titles are displayed alphabetically by default. To display them alphabetically by genre, type G at the prompt. Otherwise, simply press . Your preference? Selected award-winning movies: 1) Contact 2) Driving Miss Daisy 3) Forrest Gump 4) La La Land 5) Raiders of the Lost Ark 6) Sophie's Choice 7) Star Trek Into Darkness 8) The Queen 9) Titanic 10) X-Men ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please enter the number of the movie you would like to know more about: 8 Title: The Queen Rating: PG-13 Genre: Biography Director: Stephen Frears Star: Helen Mirren Award: Oscar for Best Performance by an Actress in a Leading Role, 2007 Inquire about another movie (Y/N)? y ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please enter the number of the movie you would like to know more about: five Movie choice must be an integer. Please try again. Exception: java.util.InputMismatchException Please enter the number of the movie you would like to know more about: 5 Title: Raiders of the Lost Ark Rating: PG Genre: Action Director: Steven Spielberg Star: Harrison Ford Award: Saturn Award for Best Actor, 1982 Inquire about another movie (Y/N)? y ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please enter the number of the movie you would like to know more about: 11 You must enter a number from 1 through 10! Please enter the number of the movie you would like to know more about: 10 5 Title: X-Men Rating: PG-13 Genre: Action Director: Bryan Singer Star: Hugh Jackman Award: Saturn Award for Best Actor, 2001 Inquire about another movie (Y/N)? N ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thanks for using our experimental database! BUILD SUCCESSFUL (total time: 2 minutes 21 seconds) Sample run #2: run: EXPERIMENTAL AWARD-WINNING MOVIE DATABASE* ----------------------------------------- (*Funded in part by IMDb.com) Movie titles are displayed alphabetically by default. To display them alphabetically by genre, type G at the prompt. Otherwise, simply press . Your preference? G Selected award-winning movies by genre: Action: 5) Raiders of the Lost Ark 10) X-Men Biography: 8) The Queen Comedy: 4) La La Land Drama: 1) Contact 2) Driving Miss Daisy 3) Forrest Gump 6) Sophie's Choice 9) Titanic Sci-Fi: 7) Star Trek Into Darkness ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please enter the number of the movie you would like to know more about: 2 Title: Driving Miss Daisy Rating: PG Genre: Drama Director: Bruce Beresford Star: Morgan Freeman Award: Golden Globe for Best Performance by an Actor in a Motion Picture - Comedy or Musical, 1990 Inquire about another movie (Y/N)? y ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please enter the number of the movie you would like to know more about: 12 You must enter a number from 1 through 10! 6 Please enter the number of the movie you would like to know more about: 7 Title: Star Trek Into Darkness Rating: PG-13 Genre: Sci-Fi Director: J.J. Abrams Star: Chris Pine Award: ASCAP Award for Top Box Office Films, 2014 Inquire about another movie (Y/N)? n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thanks for using our experimental database! BUILD SUCCESSFUL (total time: 2 minutes 11 seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago