{"id":12467,"date":"2021-10-30T03:14:18","date_gmt":"2021-10-30T03:14:18","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/assignment6-computer-science-homework-help\/"},"modified":"2021-10-30T03:14:18","modified_gmt":"2021-10-30T03:14:18","slug":"assignment6-computer-science-homework-help","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/assignment6-computer-science-homework-help\/","title":{"rendered":"Assignment6 | Computer Science homework help"},"content":{"rendered":"<div>\n<p>You can look at the Java programs in the text book to see how comments are added to programs.<\/p>\n<p>Minimal Submitted Files<\/p>\n<p>You are required, but not limited, to turn in the following source files:<\/p>\n<p>Assignment6.java (No need to modify)\u00a0<\/p>\n<p>Movie.java (No need to modify, modified version from the assignment 4)<\/p>\n<p>Review.java (No need to modify)\u00a0<\/p>\n<p>CreatePane.java &#8211; to be completed<\/p>\n<p>ReviewPane.java &#8211; to be completed<\/p>\n<p>You might need to add more methods than the specified ones.<\/p>\n<p>Skills to be Applied:<\/p>\n<p>JavaFX, ArrayList<\/p>\n<p>Classes may be needed: \u00a0<\/p>\n<p>Button, TextField, TextArea, Label, RadioButton, ListView, and ActionHandler. You may use other classes.<\/p>\n<p><strong>Here is the Assignmnet6.java:<\/strong>\u00a0<\/p>\n<pre><code>import javafx.application.Application;<br\/>import javafx.stage.Stage;<br\/>import javafx.scene.Scene;<br\/>import javafx.scene.control.Tab;<br\/>import javafx.scene.control.TabPane;<br\/>import javafx.scene.layout.StackPane;<br\/>import java.util.ArrayList;<p>public class Assignment6 extends Application<br\/>{<br\/>\u00a0\u00a0\u00a0private TabPane tabPane;<br\/>\u00a0\u00a0\u00a0private CreatePane createPane;<br\/>\u00a0\u00a0\u00a0private ReviewPane reviewPane;<br\/>\u00a0\u00a0\u00a0private ArrayList&lt;Movie&gt; movieList;<\/p><p>\u00a0\u00a0\u00a0public void start(Stage stage)<br\/>\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0StackPane root = new StackPane();<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/movieList to be used in both createPane &amp; reviewPane<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0movieList = new ArrayList&lt;Movie&gt;();<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0reviewPane = new ReviewPane(movieList);<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0createPane = new CreatePane(movieList, reviewPane);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tabPane = new TabPane();<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Tab tab1 = new Tab();<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tab1.setText(\"Movie Creation\");<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tab1.setContent(createPane);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Tab tab2 = new Tab();<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tab2.setText(\"Movie Review\");<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tab2.setContent(reviewPane);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tabPane.getSelectionModel().select(0);<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0tabPane.getTabs().addAll(tab1, tab2);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0root.getChildren().add(tabPane);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Scene scene = new Scene(root, 700, 400);<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stage.setTitle(\"Movie Review Apps\");<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stage.setScene(scene);<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stage.show();<br\/>\u00a0\u00a0\u00a0}<\/p><p>\u00a0\u00a0\u00a0public static void main(String[] args)<br\/>\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0launch(args);<br\/>\u00a0\u00a0\u00a0}<br\/>}<\/p><\/code><\/pre>\n<p><strong>Here is Movie.java:<\/strong><\/p>\n<p>public class Movie<\/p>\n<p>\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0private String movieTitle;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0private int year;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0private int length;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0private Review bookReview;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\/\/Constructor to initialize all member variables<\/p>\n<p>\u00a0\u00a0\u00a0public Movie()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0movieTitle = &#8220;?&#8221;;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0length = 0;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0year = 0;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bookReview = new Review();<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\/\/Accessor methods<\/p>\n<p>\u00a0\u00a0\u00a0public String getMovieTitle()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return movieTitle;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0public int getLength()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return length;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0public int getYear()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\t \u00a0\u00a0return year;<\/p>\n<p>\t}<\/p>\n<p>\u00a0\u00a0\u00a0public Review getReview()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return bookReview;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\/\/Mutator methods<\/p>\n<p>\u00a0\u00a0\u00a0public void setMovieTitle(String aTitle)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0movieTitle = aTitle;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0public void setLength(int aLength)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0length = aLength;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0public void setYear(int aYear)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0year = aYear;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0public void addRating(double rate)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bookReview.updateRating(rate);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\/\/toString() method returns a string containg the information on the movie<\/p>\n<p>\u00a0\u00a0\u00a0public String toString()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String result = &#8220;nMovie Title:tt&#8221; + movieTitle<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0+ &#8220;nMovie Length:tt&#8221; + length<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0+ &#8220;nMovie Year:tt&#8221; + year<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0+ &#8220;n&#8221; + bookReview.toString() + &#8220;nn&#8221;;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return result;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0}<\/p>\n<p><strong>Here is Review.java:<\/strong><\/p>\n<pre><code>import java.text.DecimalFormat;<p>public class Review<br\/>{<br\/>\u00a0\u00a0private int numberOfReviews;<br\/>\u00a0\u00a0private double sumOfRatings;<br\/>\u00a0\u00a0private double average;<\/p><p>\u00a0\u00a0\/\/Constructor to initialize all member variables<br\/>\u00a0\u00a0public Review()<br\/>\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0numberOfReviews = 0;<br\/>\u00a0\u00a0\u00a0\u00a0sumOfRatings = 0.0;<br\/>\u00a0\u00a0\u00a0\u00a0average = 0.0;<br\/>\u00a0\u00a0\u00a0}<\/p><p>\u00a0\u00a0\/\/It updates the number of REviews and avarage based on the<br\/>\u00a0\u00a0\/\/an additional rating specified by its parameter<br\/>\u00a0\u00a0public void updateRating(double rating)<br\/>\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0numberOfReviews++;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0sumOfRatings += rating;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0if (numberOfReviews &gt; 0)<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0average = sumOfRatings\/numberOfReviews;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0else<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0average = 0.0;<br\/>\u00a0\u00a0\u00a0}<\/p><p>\u00a0\u00a0\/\/toString() method returns a string containg its review average<br\/>\u00a0\u00a0\/\/and te number of Reviews<br\/>\u00a0\u00a0public String toString()<br\/>\u00a0\u00a0\u00a0{<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0DecimalFormat fmt = new DecimalFormat(\"0.00\");<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0String result = \"Reviews:t\" + fmt.format(average) + \"(\"<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0+ numberOfReviews + \")\";<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0return result;<br\/>\u00a0\u00a0\u00a0\u00a0}<br\/>\u00a0}<\/p><\/code><\/pre>\n<p><strong>Here is CreatePane.java:<\/strong><\/p>\n<p>import java.util.ArrayList;<\/p>\n<p>import javafx.scene.layout.HBox;<\/p>\n<p>\/\/import all other necessary javafx classes here<\/p>\n<p>\/\/&#8212;-<\/p>\n<p>public class CreatePane extends HBox<\/p>\n<p>{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0private ArrayList&lt;Movie&gt; movieList;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/The relationship between CreatePane and ReviewPane is Aggregation<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0private ReviewPane reviewPane;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/constructor<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0public CreatePane(ArrayList&lt;Movie&gt; list, ReviewPane rePane)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.movieList = list;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.reviewPane = rePane;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Step #1: initialize each instance variable and set up the layout<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/create a GridPane hold those labels &amp; text fields<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/consider using .setPadding() or setHgap(), setVgap()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/to control the spacing and gap, etc.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/You might need to create a sub pane to hold the button<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Set up the layout for the left half of the CreatePane.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/the right half of this pane is simply a TextArea object<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Note: a ScrollPane will be added to it automatically when there are no<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/enough space<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Add the left half and right half to the CreatePane<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Note: CreatePane extends from HBox<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Step #3: register source object with event handler<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0} \/\/end of constructor<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/Step 2: Create a ButtonHandler class<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/ButtonHandler listens to see if the button &#8220;Create a Movie&#8221; is pushed or not,<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/When the event occurs, it get a movie&#8217;s Title, Year, and Length<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/information from the relevant text fields, then create a new movie and add it inside<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/the movieList. Meanwhile it will display the movie&#8217;s information inside the text area.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\/\/It also does error checking in case any of the textfields are empty or non-numeric string is typed<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0private class ButtonHandler implements EventHandler&lt;ActionEvent&gt;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Override the abstact method handle()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void handle(ActionEvent event)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/declare any necessary local variables here<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/when a text field is empty and the button is pushed<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if ( \/\/&#8212;- \u00a0)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/handle the case here<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0else\t\/\/for all other cases<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/at the end, don&#8217;t forget to update the new arrayList<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/information on the ListView of the ReviewPane<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Also somewhere you will need to use try &amp; catch block to catch<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/the NumberFormatException<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \/\/end of handle() method<\/p>\n<p>\u00a0\u00a0\u00a0} \/\/end of ButtonHandler class<\/p>\n<p>}<\/p>\n<p><strong>Here is ReviewPane.java<\/strong><\/p>\n<p>import javafx.scene.control.ListView;<\/p>\n<p>import javafx.collections.FXCollections;<\/p>\n<p>import javafx.collections.ObservableList;<\/p>\n<p>import javafx.scene.layout.VBox;<\/p>\n<p>import javafx.event.ActionEvent;\t\/\/**Need to import to handle event<\/p>\n<p>import javafx.event.EventHandler;\t\/\/**Need to import to handle event<\/p>\n<p>import java.util.ArrayList;<\/p>\n<p>import javafx.scene.layout.HBox;<\/p>\n<p>\/\/import all other necessary javafx classes here<\/p>\n<p>\/\/&#8212;-<\/p>\n<p>public class ReviewPane extends VBox<\/p>\n<p>{<\/p>\n<p>\u00a0\u00a0\u00a0private ArrayList&lt;Movie&gt; movieList;<\/p>\n<p>\u00a0\u00a0\u00a0\/\/A ListView to display movies created<\/p>\n<p>\u00a0\u00a0\u00a0private ListView&lt;Movie&gt; movieListView;<\/p>\n<p>\u00a0\u00a0\u00a0\/\/declare all other necessary GUI variables here<\/p>\n<p>\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\/\/constructor<\/p>\n<p>\u00a0\u00a0\u00a0public ReviewPane(ArrayList&lt;Movie&gt; list)<\/p>\n<p>\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/initialize instance variables<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.movieList = list;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/set up the layout<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ReviewPane is a VBox &#8211; add the components here<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Step #3: Register the button with its handler class<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0} \/\/end of constructor<\/p>\n<p>\u00a0\/\/This method refresh the ListView whenever there&#8217;s new movie added in CreatePane<\/p>\n<p>\u00a0\/\/you will need to update the underline ObservableList object in order for ListView<\/p>\n<p>\u00a0\/\/object to show the updated movie list<\/p>\n<p>\u00a0public void updateMovieList(Movie newMovie)<\/p>\n<p>\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;&#8212;-<\/p>\n<p>\u00a0}<\/p>\n<p>\u00a0\/\/Step 2: Create a RatingHandler class<\/p>\n<p>\u00a0private class RatingHandler implements EventHandler&lt;ActionEvent&gt;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Override the abstact method handle()<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void handle(ActionEvent event)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/When &#8220;Submit Review&#8221; button is pressed and a movie is selected from<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/the list view&#8217;s average rating is updated by adding a additional<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/rating specified by a selected radio button<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (\/\/&#8212;-)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0} \/\/end of RatingHandler<\/p>\n<p>} \/\/end of ReviewPane class<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can look at the Java programs in the text book to see how comments are added to programs. Minimal Submitted Files You are required, but not limited, to turn in the following source files: Assignment6.java (No need to modify)\u00a0 Movie.java (No need to modify, modified version from the assignment 4) Review.java (No need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-12467","post","type-post","status-publish","format-standard","hentry","category-homework-help"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/12467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=12467"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/12467\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=12467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=12467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=12467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}