Question: Hi, I am brand new to Java and really need help with this homework assignment. I have used getter and setter methods in the Movie

Hi, I am brand new to Java and really need help with this homework assignment. I have used getter and setter methods in the Movie and Director class, but I do not know how to use the setter method for the Director object. Please help, thanks!

I want you to write a simple program that can represent the properties of a typical blu-ray movie. The structure of your program will consist of the following components:

- A Movie class consisting of the following private attributes: - int - duration of the movie in minutes - int - year the movie was released - double - price of the movie in USD - String - title of the movie - Director - an object representing the Director of a movie (for this assignment, you may assume the movie have only one director).

- A Director class consisting of the following private attributes: - String - first name of Director - String last name of Director - int birth year of Director - int number of films the director has directed

- A Lab1 class consisting of: - The main method that starts your Java program. You will write the appropriate accessor / mutator methods for all attributes in the classes as well as default and copy constructors. For the Movie class, you will override the method .toString() which prints out all of the information of the Movie including the details of the Director. Note: when writing the setter method for the Director attribute, you will need to pass in the appropriate fields so the Director object can be constructed. For example:

public void setDirector(String firstName, StringlastName, int birthYear, int numOfDirectedMovies) {...}

Your main method should contain code that illustrates the following functionality:

- Construct a Movie object using the default constructor. - Set the appropriate fields using the Movie's setter methods. - Print out the Movie's information (including the Directorss information) by calling the Movie's .toString() method.

Test that your copy constructor works by doing the following: - Create another movie that is a copy of your original Movie object using the copy constructor. - Print out the fields of the copied object to the console and confirm that all of the fields are the same as the original object.

Change the state of the object by: - Incrementing the number of releases for the Director of the Movie. - Print out the copied object with the updated number of releases.

In your main method, you can hard-code the values in the parameters when initially constructing your movie object. For example, to construct the object you can do the following: // Create a new movie with default values for all attributes Movie movie = new Movie(); // Set the appropriate fields for the book's objects movie.setTitle('Harry Potter and the Goblet of Fire"); movie.setPrice(19.99); movie.setYearReleased(2000); movie.setDurationInMinutes(734); movie.setDirector("J.K.", "Rowling", 1965, 7); // Prints out the state of the movie. System.out.println(movie.toString()); An example output of the following code snippet would be:

Title: Harry Potter and the Goblet of Fire Published in: 2000 Duration of Movie: 330 minutes Price: $19.99 Directed by J.K. Rowling, who was born in 1965 and has 7 releases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!