3.Modify the Java Class template:(a)In the Toolsmenu, select Templates.(b)In the dialog box that comes up, open the Javafolder, select Java Classand click the Open in Editorbutton.(c)A new file should open up containing the following text:<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include"${project.licensePath}"><#if package?? && package != "">package ${package};/**** @author ${user}*/   public class ${name} {}(d)Delete the first four lines and after @authorreplace the text ${user}with your first and last name. The file should now look like this (except with your name):<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include "${project.licensePath}"><#if package?? && package != "">package ${package};/*** * @author Alice Guy-Blache*/public class ${name} {}(e)In the Filemenu select Save. You can also click on the Save Allicon to save your files.(f)Close the Java Classfile by clicking the X on the tab.4.Create a Java class file for a Movieclass.(a)In the Filemenu select New File...(b)Under Categories:make sure that Javais selected.(c)Under File Types:make sure that Java Classis selected.(d)Click Next.(e)For Class Name:type Movie.(f)For Package:select csci1011.lab7.(g)Click Finish.(h)A text editor window should pop up with the following source code (except with your actual name):package csci1011.lab7;   /**** @author Alice Guy-Blache*/public class Movie {}5.Implement the Movieclass.(a)Add the following public instance variables to the Movieclass:•An instance variable called titleof type String.•An instance variable called directorof type String.•An instance variable called yearof type int.(b)Add the following methods to the Movieclass:•A voidmethod called readInputthat prompts the user for a title, a director, and a year, and initializes the title, director, and yearinstance variables to those values.•A voidmethod called writeOutputthat 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).6.Write code in the mainmethod of your main class to test the Movieclass:(a)Create a newMovieobject.(b)Call the readInputmethod on the object.(c)Call the writeOutputmethod on the object.(d)Prompt the user for a new title for the movie.(e)Set the titleinstance variable to the new title.(f)Call the writeOutputmethod on the object again.7.Test your program. The output should look something like this:Enter the title of the movie:Extra Terrestrial VisitorsEnter the director of the movie:Juan Piquer SimonEnter the year the movie was released:   1983Extra Terrestrial Visitors dir. Juan Piquer Simon (1983)Enter a new title:Pod PeoplePod People dir. Juan Piquer Simon (1983)8.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 getYearthat each return the values of the corresponding instance variables.(c)Add a mutator method called setMoviethat takes three arguments and uses them to initialize the three instance variables.9.Modify the mainmethod to test the new methods.(a)Remove the line that sets the titleinstance variable directly.(b)Use the getDirectorand getYearmethods to store the director and year in variables.(c)Use the setMoviemethod 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Write a class to represent a real-world concept.•Write voidmethods and methods that return values.•Write methods that have parameters.•Implement information hiding using private instance variables, accessors, and mutators.

3.Modify the Java Class template:(a)In the Toolsmenu, select Templates.(b)In the dialog box that comes up, open the Javafolder, select Java Classand click the Open in Editorbutton.(c)A new file should open up containing the following text:<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include"${project.licensePath}"><#if package?? && package != "">package ${package};</#if>/**** @author ${user}*/

 

public class ${name} {}(d)Delete the first four lines and after @authorreplace the text ${user}with your first and last name. The file should now look like this (except with your name):<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include "${project.licensePath}"><#if package?? && package != "">package ${package};</#if>/*** * @author Alice Guy-Blache*/public class ${name} {}(e)In the Filemenu select Save. You can also click on the Save Allicon to save your files.(f)Close the Java Classfile by clicking the X on the tab.4.Create a Java class file for a Movieclass.(a)In the Filemenu select New File...(b)Under Categories:make sure that Javais selected.(c)Under File Types:make sure that Java Classis selected.(d)Click Next.(e)For Class Name:type Movie.(f)For Package:select csci1011.lab7.(g)Click Finish.(h)A text editor window should pop up with the following source code (except with your actual name):package csci1011.lab7;

 

/**** @author Alice Guy-Blache*/public class Movie {}5.Implement the Movieclass.(a)Add the following public instance variables to the Movieclass:•An instance variable called titleof type String.•An instance variable called directorof type String.•An instance variable called yearof type int.(b)Add the following methods to the Movieclass:•A voidmethod called readInputthat prompts the user for a title, a director, and a year, and initializes the title, director, and yearinstance variables to those values.•A voidmethod called writeOutputthat 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).6.Write code in the mainmethod of your main class to test the Movieclass:(a)Create a newMovieobject.(b)Call the readInputmethod on the object.(c)Call the writeOutputmethod on the object.(d)Prompt the user for a new title for the movie.(e)Set the titleinstance variable to the new title.(f)Call the writeOutputmethod on the object again.7.Test your program. The output should look something like this:Enter the title of the movie:Extra Terrestrial VisitorsEnter the director of the movie:Juan Piquer SimonEnter the year the movie was released:

 

1983Extra Terrestrial Visitors dir. Juan Piquer Simon (1983)Enter a new title:Pod PeoplePod People dir. Juan Piquer Simon (1983)8.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 getYearthat each return the values of the corresponding instance variables.(c)Add a mutator method called setMoviethat takes three arguments and uses them to initialize the three instance variables.9.Modify the mainmethod to test the new methods.(a)Remove the line that sets the titleinstance variable directly.(b)Use the getDirectorand getYearmethods to store the director and year in variables.(c)Use the setMoviemethod 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 Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 8 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education