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
-
dy Use implicit differentiation to determine given the equation x + y5 = 5. dx dy dx = Question Help: Video Submit Question
-
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?
-
A bell-shaped or B-spline u = 0(x) interpolates the data (a) Find the explicit formula for the natural 5- spline and plot its graph. (b) Show that 0(x) also satisfies the homogeneous clamped boundary...
-
The comparative financial statements of Blue Sky Supply for 2025, 2024, and 2023 include the data shown here: Requirements 1. Compute these ratios for 2025 and 2024: a. Acid-test ratio (Round to two...
-
A fractional extraction system (Figure 13-5) is separating abietic acid from other acids. Solvent 1 , heptane, enters at \(\mathrm{E}-=1000 \mathrm{~kg} / \mathrm{h}\) and is pure. Solvent 2,...
-
Review the Diversity Competency feature entitled Chubbs Business Case for Diversity. In what three ways do you agree and/or disagree with this business case for diversity?
-
Based on Fiedler's contingency leadership model, which type of leaders are more effective in situations of moderate favourability? a . Strong leaders b . Task - oriented leaders c . Relationship -...
-
Salazar Company is a job-order costing firm that uses activity-based costing to apply overhead to jobs. Salazar identified three overhead activities and related drivers. Budgeted information for the...
-
Suppose you purchase the July 2020 call option on corn futures with a strike price of $3.15. Assume you purchased the option at the last price of the day. Use Table 23.2. a. How much does your option...
-
6.8 Using Passives and Impersonal Constructions to Improve You-Attitude 1. You did not apply on time for admission to our college. 2. You did not include a self-addressed, stamped envelope with your...
-
1. What difference in time to see an effect was observed for the different lakes? Which lakes reacted more slowly and which reacted more quickly after the pollutant began to be generated? 2. Was the...
-
For the following situation, find the average monthly expense that you would use in budgeting for the given expense. Note: Annual means once a year, and semiannual means twice a year. Sara pays $5000...
-
Three forces act on a particle that moves with unchanging velocity = (1.5 m/s ) + (-7.2 m/s). Two of the forces are F and F2 = 1 = 1.4 N )i + (2.6 N ) +(-2.1 N 4.4 N )+ (3.2 N ) + (1.6 N . What is...
-
What is a referential integrity constraint, and why are these constraints important? What happens to our database if we don't put in our referential integrity constraints? What are other types of...
-
A 10 Curie source of Co-60 is discovered in an unused vault. A label on the source indicates the source was created March 1, 1942. What is the activity of the source today in uCi?(2 pts) Na-24 is...
-
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...
-
Rebecca Odin has the following details of her property, plant and equipment. She charges depreciation at 2% per annum on cost for buildings, 10% per annum on cost for machinery, 25% per annum on cost...
-
Deborah Urer owns a small bar. Her trial balance as at 30 June 2012 is set out below. You also have the following additional information. 1. Closing inventory is 6,250. 2. There is 200 owing for...
-
Why do you think that three different types of business enterprise (sole traders, partnerships and limited companies) exist?
Study smarter with the SolutionInn App