Objective: Covers the usage of Exception handling, Inheritance, Interfaces, abstract classes, Sets and Maps
Description: Movie crew is a group of people hired by a production company for the purpose of producing a movie/film. The movie crew is divided into different departments, each of which specializes in a specific aspect of the movie production.
Create a package and name it enums.
Genre enum:
This enum contains the genre of a Movie with age-associated to it.
Constant | age |
BIOGRAPHY | 3 |
DRAMA | 5 |
FANTASY | 3 |
HORROR | 17 |
MYSTERY | 10 |
POETRY | 1 |
ROMANCE | 12 |
SCIENCE_FICTION | 8 |
THRILLER | 13 |
MPAA_Rating enum:
This enum contains the Motion Picture Association of America(MPAA) rating description and age restriction for DVD.
Constant | description | age |
G | General Audiences | 0 |
NC_17 | Adults Only | 18 |
PG | Parental Guidance Suggested | 12 |
PG_13 | Parents Strongly Cautioned | 13 |
R | Restricted | 17 |
Roles enum:
This enum contains different Roles in movie making.
Constant |
DIRECTOR |
PRODUCER |
MUSIC_DIRECTOR |
ART_DIRECTOR |
ENGINEERING_SERVICES |
SPECIAL_EFFECTS |
MUSIC_EDITOR |
VFX_ART_DIRECTOR |
STUNT_COORDINATOR |
STUNT_PERFORMER |
Create a package and name it movies.
Person class:
This abstract class implements Comparable interface and will contain below attributes, shown in the table. All attributes are private.
Attribute | Type | Attribute Description |
firstName | String | First name of the person |
lastName | String | Last name of the person |
- Constructor: Two argument constructor to initialize all private instance variables.
- Write getter methods for the above-mentioned
- Generate hashCode and equals method for all private variables.
- Abstract Method:
- compareTo(Person): This method accepts Person object as a parameter.
- toString(): This method overrides the toString() of Person Please see sample output below.
Sample Output:
Prabas Raju
Actor class:
This class extends person class and contains below private attributes.
Attribute | Type | Attribute Description |
age | int | Age of an Actor |
remuneration | double | Remuneration of an Actor |
- Constructor: Two argument constructor to initialize super class constructor and all private instance variables of Actor.
- Write getter methods for the above-mentioned
- compareTo(Person): This method accepts Person object as a parameter and compares based on the remuneration of Actor in descending order.
- toString(): This method overrides the toString() of Person Please see sample output below.
Sample Output:
Prabas Raju Age: 28
Technician class:
This class extends person class and contains below private attributes.
Attribute | Type | Attribute Description |
role | Roles | Role of a technician in the movie |
- Constructor: One argument constructor to initialize super class constructor and all private instance variables of Technician.
- Write getter methods for the above mentioned
- compareTo(Person): This method accepts Person object as a parameter and compares based on Role of Technician.
- toString(): This method overrides the toString() of Person Please see sample output below.
Sample Output:
Rajamouli SS DIRECTOR
Movie class:
This class implements Comparable interface and will contain below private attributes.
Attribute | Type | Attribute Description |
title | String | Title of the movie |
genre | Genre | The genre of the movie |
rating | MPAA_Rating | MPAA_Rating of the movie |
collections | double | collections collected by a movie in double |
characters | HashMap<String,Actor> | A unique set of character names with respective Actor |
- Constructor: The four argument constructor will accept title, genre, rating and collections as parameters and will initialize all private variables of Movie.
- Write getter methods for the above-mentioned
Methods:
- addCharacter(String characterName, Actor actor): This method accepts character name of type String in the movie and respective Actor object as a parameter. This method adds given characters with respective Actors in
- compareTo(Genre): This method accepts Genre object as a parameter and compares to Genre of current
- toString(): This method overrides the toString() of Object Please see sample output below.
Sample Output:
Billa
Genre: Mystery Rating: NC_17 (18 Years)
Collections: $100000000.00
Cast:
——————————————————
Character Played Actor Name
——————————————————
Darling Anushka Shetty
Ranga Prabas Raju
MovieMapping class:
This class contains below private attributes.
Attribute | Type | Attribute Description |
movieMap | HashMap<Movie, LinkedList<Person>> | This attribute contains a set of movies and respective persons worked/acted in it. |
- Constructor: No argument constructor to initialize all private variables of MovieMapping
- Write getter methods for the above-mentioned
Methods:
- addMovieCrewPerson (Movie movie, Person person): This method accepts Movie and Person objects as parameters. This method adds given Person to the list of persons of the given Movie in movieMap, if there is no existing list of persons for the given movie in movieMap then create a new LinkedList and add given Person to respective Movie.
- getListOfMoviesAPersonActed(String actorFullName): This method accepts actor name of type String. This method returns a list of Movies an actor acted.
- Format of actorFullName: “firstName LastName”
- Example: Emma Watson
- getAllTechnicians (String movieName): This method accepts the movie name of type String. This method returns a list of Technicians who worked for the given movie.
- getListOfCharacterNames(String actor): This method accepts actor name of type String. This method returns a list of character names (of type String) for the given actor has acted in all movies in movieMap.
- Format of actor: “firstName LastName”
- Example: Emma Watson
- getAllActors(): This method does not accept any parameters and returns a list of all the actors from all the movies in the movieMap
- toString(): This method overrides the toString() of Object Please see sample output below.
- Format of actor: “firstName LastName”
- Format of actorFullName: “firstName LastName”
Sample Output:
******************************************************
Billa
Genre: Mystery Rating: NC_17 (18 Years)
Collections: $100000000.00
Cast:
——————————————————
Character Played Actor Name
——————————————————
Darling Anushka Shetty
Ranga Prabas Raju
——————————————————
Movie crew
——————————————————
Name Role
——————————————————
Meher Ramesh DIRECTOR
Mani Sharma MUSIC_EDITOR
******************************************************
Bahubali
Genre: Drama Rating: G (0 Years)
Collections: $130000000.00
Cast:
——————————————————
Character Played Actor Name
——————————————————
Bhalaladeva Rana Daggubati
Devasena Anushka Shetty
Amarendra Bahubali Prabas Raju
——————————————————
Movie crew
——————————————————
Name Role
——————————————————
Rajamouli SS DIRECTOR
Keeravani MM MUSIC_EDITOR
******************************************************
Note: Please note that the order doesn’t matter for list of actors from movies. As long as the number of values are matching.
Sample Output:
****************************************************** Details of all movies in mapper ****************************************************** Baahubali: The Beginning Genre: DRAMA Rating: G (0 Years) Collections: $1040000000.00 Cast: —————————————————— Character Played Actor Name —————————————————— Shivudu / Baahubali Prabhas Raju Kattappa Sathyaraj Rangaraj Bhallaladeva Rana Daggubati Avanthika Tamannaah Bhatia Devasena Anushka Shetty Shivagami Ramya Krishna Bijjaladeva Nassar N —————————————————— Movie crew —————————————————— Name Role —————————————————— M.M. Keeravani MUSIC_DIRECTOR Sabu Cyril ART_DIRECTOR Yovko Dogandjiiski SPECIAL_EFFECTS Adel Adili VFX_ART_DIRECTOR Kaloian Vodenicharov STUNT_COORDINATOR Lee Whittaker STUNT_COORDINATOR Viktor Hristov STUNT_PERFORMER Stilyan Mavrov STUNT_PERFORMER ****************************************************** Taare Zameen Par Genre: DRAMA Rating: PG (12 Years) Collections: $12540000.00 Cast: —————————————————— Character Played Actor Name —————————————————— Maya Awasthi Tisca Chopra Ishaan Awasthi Darsheel Safary Ram Shankar Nikumbh Aamir Khan —————————————————— Movie crew —————————————————— Name Role —————————————————— Aamir Khan DIRECTOR Ayush Ahuja SPECIAL_EFFECTS ****************************************************** Avengers: Infinity War Genre: FANTASY Rating: PG (12 Years) Collections: $2047000000.00 Cast: —————————————————— Character Played Actor Name —————————————————— Loki Tom Hiddleston Steve Rogers / Captain America Chris Evans Nebula Karen Gillan Wanda Maximoff / Scarlet Witch Elizabeth Olsen Peter Parker / Spider Man Tom Holland Tony Stark / Iron Man Robert Downey Doctor Strange Benedict Cumberbatch Thor Chris Hemsworth Bruce Banner / Hulk Mark Ruffalo Natasha Romanoff / Black Widow Scarlett Johansson James Rhodes / War Machine Don Cheadle Vision Paul Bettany T’Challa / Black Panther Chadwick Boseman Sam Wilson / Falcon Anthony Mackie Gamora Zoe Saldana —————————————————— Movie crew —————————————————— Name Role —————————————————— Anthony Russo DIRECTOR Joe Russo DIRECTOR Sean Ryan VFX_ART_DIRECTOR Marija Juliette STUNT_PERFORMER Chris Barnes STUNT_COORDINATOR Steve Durkee MUSIC_EDITOR ****************************************************** Ye Maaya Chesave Genre: ROMANCE Rating: PG_13 (13 Years) Collections: $2800000.00 Cast: —————————————————— Character Played Actor Name —————————————————— Karthik Naga Chaitanya Jessie Thekekuttu Samantha Akkineni —————————————————— Movie crew —————————————————— Name Role —————————————————— Manjula Ghattamaneni PRODUCER Allah-Rakha Rahman MUSIC_DIRECTOR Rajeevan K ART_DIRECTOR ****************************************************** Billa Genre: THRILLER Rating: PG (12 Years) Collections: $30900000.00 Cast: —————————————————— Character Played Actor Name —————————————————— Ranga / Billa Prabhas Raju Maya Anushka Shetty —————————————————— Movie crew —————————————————— Name Role —————————————————— Mehar Ramesh DIRECTOR Stun Shiva STUNT_PERFORMER Mani Sharma MUSIC_DIRECTOR A.S. Prakash ART_DIRECTOR
****************************************************** All technicians mapped with in movie Avengers ****************************************************** Anthony Russo DIRECTOR Joe Russo DIRECTOR Sean Ryan VFX_ART_DIRECTOR Marija Juliette STUNT_PERFORMER Chris Barnes STUNT_COORDINATOR Steve Durkee MUSIC_EDITOR ****************************************************** Character names of actor Prabas Raju in different movies ****************************************************** Ranga / Billa Shivudu / Baahubali ****************************************************** List of movies Anushka Shetty acted ****************************************************** Baahubali: The Beginning Billa ****************************************************** List of all actors from all movies in the map ****************************************************** Robert Downey Age: 50 Chris Hemsworth Age: 38 Benedict Cumberbatch Age: 45 Mark Ruffalo Age: 46 Chris Evans Age: 37 Paul Bettany Age: 42 Don Cheadle Age: 46 Elizabeth Olsen Age: 24 Scarlett Johansson Age: 35 Tom Hiddleston Age: 34 Chadwick Boseman Age: 30 Karen Gillan Age: 30 Zoe Saldana Age: 28 Tom Holland Age: 18 Prabhas Raju Age: 35 Rana Daggubati Age: 29 Anthony Mackie Age: 35 Nassar N Age: 62 Sathyaraj Rangaraj Age: 60 Ramya Krishna Age: 50 Aamir Khan Age: 58 Anushka Shetty Age: 30 Naga Chaitanya Age: 27 Tamannaah Bhatia Age: 29 Samantha Akkineni Age: 29 Darsheel Safary Age: 28 Tisca Chopra Age: 50 ****************************************************** List of all movies sorted based on gross collections in descending order ****************************************************** Avengers: Infinity War $2047000000.00 Baahubali: The Beginning $1040000000.00 Billa $30900000.00 Taare Zameen Par $12540000.00 Ye Maaya Chesave $2800000.00 |
For Testing:
- Create a source folder in the project and name it as test.
- Now right click on MovieMapping class in src folder
- Click on new -> Junit test case
- Select New JUnit 4 test case
- In source folder path, change src to test and click on finish.
Submit your solution by following the steps below:
- Save your files in Eclipse.
- Zip your entire Project. (It should be called LastnameAssignment02A.zip where the Last name is your last name.)
- Generate Javadoc
- Submit the Zip file to the Assignment02A.
- Download the Zip file which you have submitted.
- Look into the Zip file and verify the class files are updated. If not resave your project in Eclipse and resubmit.