5. Implement the Movie class. 6. (a) Add the following public instance variables to the Movie...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
5. Implement the Movie class. 6. (a) Add the following public instance variables to the Movie class: An instance variable called title of type String. An instance variable called director of type String. An instance variable called year of type int. (b) Add the following methods to the Movie class: A void method called readinput that prompts the user for a title, a director, and a year, and initializes the title, director, and year instance variables to those values. A void method called writeOutput that displays the title and director of the movie followed by the year in parentheses. For example, if the title of the movie is Blade Runner, the director is Ridley Scott and the year is 1982, it should display Blade Runner dir. Ridley Scott (1982). Write code in the main method of your main class to test the Movie class: (a) Create a new Movie object. (b) Call the read Input method on the object. (c) Call the writeOutput method on the object. (d) Prompt the user for a new title for the movie. (e) Set the title instance variable to the new title. (f) Call the writeOutput method on the object again. 7. Test your program. The output should look something like this: Enter the title of the movie: Extra Terrestrial Visitors Enter the director of the movie: 8. 9. Juan Piquer Simon Enter the year the movie was released: 1983 Extra Terrestrial Visitors dir. Juan Piquer Simon (1983) Enter a new title: Pod People Pod People dir. Juan Piquer Simon (1983) Modify your program so it uses information hiding. (a) Change all of the public instance variables to private instance variables. (b) Add accessor methods getTitle, getDirector, and get Year that each return the values of the corresponding instance variables. (c) Add a mutator method called setMovie that takes three arguments and uses them to initialize the three instance variables. Modify the main method to test the new methods. (a) Remove the line that sets the title instance variable directly. (b) Use the getDirector and getYear methods to store the director and year in variables. (c) Use the setMovie method to reset the instance variables using the new title, the old director, and the old year. (d) Make sure that you display the movie as you did before. 10. Test your program. The output should look exactly the same as it did before. 5. Implement the Movie class. 6. (a) Add the following public instance variables to the Movie class: An instance variable called title of type String. An instance variable called director of type String. An instance variable called year of type int. (b) Add the following methods to the Movie class: A void method called readinput that prompts the user for a title, a director, and a year, and initializes the title, director, and year instance variables to those values. A void method called writeOutput that displays the title and director of the movie followed by the year in parentheses. For example, if the title of the movie is Blade Runner, the director is Ridley Scott and the year is 1982, it should display Blade Runner dir. Ridley Scott (1982). Write code in the main method of your main class to test the Movie class: (a) Create a new Movie object. (b) Call the read Input method on the object. (c) Call the writeOutput method on the object. (d) Prompt the user for a new title for the movie. (e) Set the title instance variable to the new title. (f) Call the writeOutput method on the object again. 7. Test your program. The output should look something like this: Enter the title of the movie: Extra Terrestrial Visitors Enter the director of the movie: 8. 9. Juan Piquer Simon Enter the year the movie was released: 1983 Extra Terrestrial Visitors dir. Juan Piquer Simon (1983) Enter a new title: Pod People Pod People dir. Juan Piquer Simon (1983) Modify your program so it uses information hiding. (a) Change all of the public instance variables to private instance variables. (b) Add accessor methods getTitle, getDirector, and get Year that each return the values of the corresponding instance variables. (c) Add a mutator method called setMovie that takes three arguments and uses them to initialize the three instance variables. Modify the main method to test the new methods. (a) Remove the line that sets the title instance variable directly. (b) Use the getDirector and getYear methods to store the director and year in variables. (c) Use the setMovie method to reset the instance variables using the new title, the old director, and the old year. (d) Make sure that you display the movie as you did before. 10. Test your program. The output should look exactly the same as it did before.
Expert Answer:
Answer rating: 100% (QA)
Below is an example Java implementation for the Movie class based on the provided instructions java ... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
for the equality test for M and N. The question concerns how to represent multisets of strings within ML. For each of the given data representations (a), (b) and (c) describe how you would implement...
-
What are the different relays that employed for protection of apparatus and transmission lines?
-
In use on a typical human nose, the end-to-end distance is measured to be 30 mm. What force does the strip exert on the nasal passages in this situation? A. 0.23 N B. 0.69 N C. 9.0 N D. 2 N
-
Five jobs are to be processed on one machine. If the jobs are processed in the FCFS order 1-2-3-4-5, compute the start time and flow time for each job. Job Processing time 1 2 8 3 3 5 4 9 5 4
-
If your instructor assigns a marketing plan for your class, we hope you will be excitedfor two reasons. First, you will get insights into trying to actually do marketing that often go beyond what you...
-
Johnson Chemicals is considering two options for its supplier portfolio. Option 1 uses two local suppliers. Each has a unique- event risk of 5%, and the probability of a super- event that would...
-
Find all complex roots of the following equations: (a) z + 64 = 0 (b) z5 +243 = 0 Write the result in the conventional form, i.e., as a sum of the real and imaginary parts. Show all details of work.
-
Bartov Corporation reports the following beginning inventory and purchases for 2020: Bartov sells 600 of these units in 2020. Compute its cost of goods sold for 2020 and the ending inventory reported...
-
Question 1 Oscar Teng started a part-time web design business from home about a year ago. As of 31 December 2022, the business has the following accounts. All the accounts have normal balances. $...
-
A small company that trains executives on how to act when working in Japan had $70,000 worth of inventory on January 1, 2018, and it had $50,000 worth of inventory on December 31, 2018. If its cost...
-
A lawsuit must at least have a clear object or a lawsuit must fulfill the elements of a lawsuit such as having the identity of the plaintiff and defendant. If it does not fulfill the requirements or...
-
ULA V-(0.750 m/s)i A cruise ship with a mass of 107 kg strikes a pier at a speed of 0.750 m/s. After traveling 5.93 meters, damaging the ship and the pler, determine the average force in Newtons...
-
Describe the seven-step process of managing anger introduced by Dr Lynn McClure in detail.
-
Find all the zeros of the function given the zeros already provided. 6) f(x) = 5x + 4x - 11x + 2; -2 5 7) f(x)= 9x - 36x + 17x + 30; 3
-
Find the sampling plan based on producer insight using the following data: N = 2000 AQL = 0.08 nonconforming not more than 5% Inspection cost Rp 300/product warranty cost Rp 2500/product and...
-
The registrar of a college with a population of N = 4,000 full-time students is asked by the president to conduct a survey to measure satisfaction with the quality of life on campus. The following...
-
Demonstrate that large integers like 1234567890 are equivalent to their counterparts with the underscore separators, namely 1_234_567_890: a) 1234567890 == 1_234_567_890 b) Print each of these values...
-
Give the method header for each of the following methods: a) Method Hypotenuse, which takes two double-precision, floating-point arguments side1 and side2 and returns a double-precision,...
-
Defined a two-dimensional array of grades with 10 rows and three columns, representing 10 students grades on three exams. Use a stream pipeline to calculate the average of all the grades. For this...
-
Explain two ways a fixed-for-fixed currency swap can be valued.
-
Explain the difference between the credit risk and the market risk in a swap.
-
The time-series graph in Figure 24 depicts the number of residents in the United States living in poverty. Why might this graph be considered misrepresentative? Approach Look for any characteristics...
Study smarter with the SolutionInn App