Question

(1) DisneyMovies.java To be initialized, a DisneyMovies object must have a name. In addition, every DisneyMovies...

(1) DisneyMovies.java

To be initialized, a DisneyMovies object must have a name. In addition, every DisneyMovies has an ArrayList of Movies objects.
The DisneyMovies will be the access point for the data in the remainder of the app.

The controller will call on methods in the DisneyMovies class to access Movies names, cast information, and to load data in the files.

(2) Movies.java

A Movies object must have:

  • A name (i.e. The Lion King)

  • Unique ID (i.e. TLK-2019)

  • A genre of Movies (i.e. Comedy)

  • An ArrayList of Cast objects

    There is no limit on the number of cast members in Movies (3)Cast.java

  • A Cast object must have:

  • A character name (i.e. Woody)

  • Corresponding actor’s name (i.e. Tom Hanks)

  • Role or occupation of the character in the movie (i.e. Sheriff)

  • Primary nationality of the actor (i.e. American)

    The remaining design of the model of this app is up to you - you may add other model classes if you find it necessary.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Following code contatins various classes with implementation for the given requirement:

1. Test Class with sample data

 import java.util.ArrayList; public class Test {      public static void main(String[] args) {                //Intialize DisneyMovies class          DisneyMovies disneyMovies = new DisneyMovies();                 //Initialize Movies class               Movies movies = new Movies();           // Cast 1 initializes and values are set                Cast cast1 = new Cast();                cast1.setActorName("Will Smith");               cast1.setCharacterName("Genie");                cast1.setNationality("American");               cast1.setRole("Spirit");                // Cast 1 initializes and values are set                Cast cast2 = new Cast();                cast2.setActorName("Mena");             cast2.setCharacterName("Aladdin");              cast2.setRole("Thief");                 cast2.setNationality("Canadian");               // Adding casts to ArrayList            ArrayList<Cast> castList = new ArrayList<Cast>();           castList.add(cast1);            castList.add(cast2);            //set casts to movies and other values          movies.setCast(castList);               movies.setGenre("Fantady");             movies.setName("Aladdin");              movies.setUniqueID("Mov001");           //set movies to disneyMovies object             ArrayList<Movies> movieList=new ArrayList<Movies>();                movieList.add(movies);          disneyMovies.setMovies(movieList);              // test run             System.out.println(disneyMovies.getMovies().get(0).getCast().get(0).getActorName()+" as "+disneyMovies.getMovies().get(0).getCast().get(0).getCharacterName());                 System.out.println(disneyMovies.getMovies().get(0).getCast().get(1).getActorName()+" as "+disneyMovies.getMovies().get(0).getCast().get(1).getCharacterName());         } }

2. Disney Movies

 import java.util.ArrayList; public class DisneyMovies {    private String name;    private ArrayList<Movies> movies;         public String getName() {               return name;    }       public void setName(String name) {              this.name = name;       }       public ArrayList<Movies> getMovies() {            return movies;  }       public void setMovies(ArrayList<Movies> movies) {                 this.movies = movies;   } } 

3. Movies Class

 import java.util.ArrayList; public class Movies {   private String name;    private String uniqueID;        private String genre;   private ArrayList<Cast> cast;     public String getName() {               return name;    }       public void setName(String name) {              this.name = name;       }       public String getUniqueID() {           return uniqueID;        }       public void setUniqueID(String uniqueID) {              this.uniqueID = uniqueID;       }       public String getGenre() {              return genre;   }       public void setGenre(String genre) {            this.genre = genre;     }       public ArrayList<Cast> getCast() {                return cast;    }       public void setCast(ArrayList<Cast> cast) {               this.cast = cast;       } } 

4. Cast Class

  public class Cast {  private String characterName;   private String actorName;       private String role;    private String nationality;     public String getCharacterName() {              return characterName;   }       public void setCharacterName(String characterName) {            this.characterName = characterName;     }       public String getActorName() {          return actorName;       }       public void setActorName(String actorName) {            this.actorName = actorName;     }       public String getRole() {               return role;    }       public void setRole(String role) {              this.role = role;       }       public String getNationality() {                return nationality;     }       public void setNationality(String nationality) {                this.nationality = nationality;         } } 

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
(1) DisneyMovies.java To be initialized, a DisneyMovies object must have a name. In addition, every DisneyMovies...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Objective In this assignment, you will practice solving a problem using object-oriented programming and specifically, you...

    Objective In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will use the concept of object aggregation (i.e., has-a relationship between objects). You will implement a Java application, called MovieApplication that could be used in the movie industry. You are asked to implement three classes: Movie, Distributor, and MovieDriver. Each of these classes is described below. Problem Description The Movie class represents a movie and has the following attributes: name (of type String), directorName...

  • Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU...

    Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU START: // This homework is built on homework 06. The given program is an updated version of hw06 solution. It begins by displaying a menu to the user // with the add() function from the last homework, as well as some new options: add an actor/actress to a movie, display a list of movies for // an actor/actress, delete all movies, display all movies,...

  • Java Object Array With 2 Elements In 1 Object

    1. Create a UML diagram to help design the class described in Q2 below. Do this exercise before you attempt to code the solution. Think about what instance variables will be required to describe a Person class object; should they be private or public? Determine what class methods are required; should they be private or public?2. Write Java code for a Person class. A Person has a name of type String and an age of type integer.Supply two constructors: one will be...

  • WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL...

    WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...

  • The object ticTacToeBoard is initialized to indicate if the computer is the player 1 or player...

    The object ticTacToeBoard is initialized to indicate if the computer is the player 1 or player 2. Your task is to allow turns between the player and computer and to determine if a winner exists. The TicTacToeBoard class uses a Character class which is a wrapper class for char. It allows for the value null. Thus, the board values can be ‘X’,’O’ or null. Program Requirements In the TicTacToe class, set the existing Long variable named securityCode with a value...

  • Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use...

    Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use the Java iteration constructs (while, do, for). Use Boolean variables and expressions to control iterations. Use arrays or ArrayList for storing objects. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a...

  • Java 1. Develop a program to emulate a purchase transaction at a retail store. This program...

    Java 1. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual line item of merchandise that a customer is purchasing. The Transaction class will combine several LineItem objects and calculate an overall total price for the line item within the transaction. There will also be two test classes, one for the LineItem class and one for the...

  • This is a java file and I am very confused on how to do this project!...

    This is a java file and I am very confused on how to do this project! please help!! Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT