SlideShare a Scribd company logo
1 of 19
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)
Movie.java (No need to modify, modified version from the
assignment 4)
Review.java (No need to modify)
CreatePane.java - to be completed
ReviewPane.java - to be completed
You might need to add more methods than the specified ones.
Skills to be Applied:
JavaFX, ArrayList
Classes may be needed:
Button, TextField, TextArea, Label, RadioButton, ListView, and
ActionHandler. You may use other classes.
Here is the Assignmnet6.java:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import java.util.ArrayList;
public class Assignment6 extends Application
{
private TabPane tabPane;
private CreatePane createPane;
private ReviewPane reviewPane;
private ArrayList movieList;
public void start(Stage stage)
{
StackPane root = new StackPane();
//movieList to be used in both createPane & reviewPane
movieList = new ArrayList();
reviewPane = new ReviewPane(movieList);
createPane = new CreatePane(movieList, reviewPane);
tabPane = new TabPane();
Tab tab1 = new Tab();
tab1.setText("Movie Creation");
tab1.setContent(createPane);
Tab tab2 = new Tab();
tab2.setText("Movie Review");
tab2.setContent(reviewPane);
tabPane.getSelectionModel().select(0);
tabPane.getTabs().addAll(tab1, tab2);
root.getChildren().add(tabPane);
Scene scene = new Scene(root, 700, 400);
stage.setTitle("Movie Review Apps");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
Here is Movie.java:
public class Movie
{
private String movieTitle;
private int year;
private int length;
private Review bookReview;
//Constructor to initialize all member variables
public Movie()
{
movieTitle = "?";
length = 0;
year = 0;
bookReview = new Review();
}
//Accessor methods
public String getMovieTitle()
{
return movieTitle;
}
public int getLength()
{
return length;
}
public int getYear()
{
return year;
}
public Review getReview()
{
return bookReview;
}
//Mutator methods
public void setMovieTitle(String aTitle)
{
movieTitle = aTitle;
}
public void setLength(int aLength)
{
length = aLength;
}
public void setYear(int aYear)
{
year = aYear;
}
public void addRating(double rate)
{
bookReview.updateRating(rate);
}
//toString() method returns a string containg the information
on the movie
public String toString()
{
String result = "nMovie Title:tt" + movieTitle
+ "nMovie Length:tt" + length
+ "nMovie Year:tt" + year
+ "n" + bookReview.toString() + "nn";
return result;
}
}
Here is Review.java:
import java.text.DecimalFormat;
public class Review
{
private int numberOfReviews;
private double sumOfRatings;
private double average;
//Constructor to initialize all member variables
public Review()
{
numberOfReviews = 0;
sumOfRatings = 0.0;
average = 0.0;
}
//It updates the number of REviews and avarage based on the
//an additional rating specified by its parameter
public void updateRating(double rating)
{
numberOfReviews++;
sumOfRatings += rating;
if (numberOfReviews > 0)
{
average = sumOfRatings/numberOfReviews;
}
else
average = 0.0;
}
//toString() method returns a string containg its review
average
//and te number of Reviews
public String toString()
{
DecimalFormat fmt = new DecimalFormat("0.00");
String result = "Reviews:t" + fmt.format(average) + "("
+ numberOfReviews + ")";
return result;
}
}
Here is CreatePane.java:
import java.util.ArrayList;
import javafx.scene.layout.HBox;
//import all other necessary javafx classes here
//----
public class CreatePane extends HBox
{
private ArrayList movieList;
//The relationship between CreatePane and ReviewPane is
Aggregation
private ReviewPane reviewPane;
//constructor
public CreatePane(ArrayList list, ReviewPane rePane)
{
this.movieList = list;
this.reviewPane = rePane;
//Step #1: initialize each instance variable and set up the
layout
//----
//create a GridPane hold those labels & text fields
//consider using .setPadding() or setHgap(), setVgap()
//to control the spacing and gap, etc.
//----
//You might need to create a sub pane to hold the button
//----
//Set up the layout for the left half of the CreatePane.
//----
//the right half of this pane is simply a TextArea object
//Note: a ScrollPane will be added to it automatically
when there are no
//enough space
//Add the left half and right half to the CreatePane
//Note: CreatePane extends from HBox
//----
//Step #3: register source object with event handler
//----
} //end of constructor
//Step 2: Create a ButtonHandler class
//ButtonHandler listens to see if the button "Create a Movie"
is pushed or not,
//When the event occurs, it get a movie's Title, Year, and
Length
//information from the relevant text fields, then create a new
movie and add it inside
//the movieList. Meanwhile it will display the movie's
information inside the text area.
//It also does error checking in case any of the textfields are
empty or non-numeric string is typed
private class ButtonHandler implements EventHandler
{
//Override the abstact method handle()
public void handle(ActionEvent event)
{
//declare any necessary local variables here
//---
//when a text field is empty and the button is pushed
if ( //---- )
{
//handle the case here
}
else //for all other cases
{
//----
//at the end, don't forget to update the new
arrayList
//information on the ListView of the ReviewPane
//----
//Also somewhere you will need to use try & catch
block to catch
//the NumberFormatException
}
} //end of handle() method
} //end of ButtonHandler class
}
Here is ReviewPane.java
import javafx.scene.control.ListView;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.layout.VBox;
import javafx.event.ActionEvent; //**Need to import to
handle event
import javafx.event.EventHandler; //**Need to import to
handle event
import java.util.ArrayList;
import javafx.scene.layout.HBox;
//import all other necessary javafx classes here
//----
public class ReviewPane extends VBox
{
private ArrayList movieList;
//A ListView to display movies created
private ListView movieListView;
//declare all other necessary GUI variables here
//----
//constructor
public ReviewPane(ArrayList list)
{
//initialize instance variables
this.movieList = list;
//set up the layout
//----
//ReviewPane is a VBox - add the components here
//----
//Step #3: Register the button with its handler class
//----
} //end of constructor
//This method refresh the ListView whenever there's new movie
added in CreatePane
//you will need to update the underline ObservableList object
in order for ListView
//object to show the updated movie list
public void updateMovieList(Movie newMovie)
{
//-------
}
//Step 2: Create a RatingHandler class
private class RatingHandler implements EventHandler
{
//Override the abstact method handle()
public void handle(ActionEvent event)
{
//When "Submit Review" button is pressed and a movie
is selected from
//the list view's average rating is updated by adding a
additional
//rating specified by a selected radio button
if (//----)
{
//----
}
}
} //end of RatingHandler
} //end of ReviewPane class
You can look at the Java programs in the text book to see how commen

More Related Content

Similar to You can look at the Java programs in the text book to see how commen

Unit Testing using PHPUnit
Unit Testing using  PHPUnitUnit Testing using  PHPUnit
Unit Testing using PHPUnitvaruntaliyan
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdfanithareadymade
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And RefactoringNaresh Jain
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitJames Fuller
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfamitbagga0808
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
Setup Java Path and classpath (from the java™ tutorials essential classes -...
Setup Java Path and classpath (from the java™ tutorials   essential classes -...Setup Java Path and classpath (from the java™ tutorials   essential classes -...
Setup Java Path and classpath (from the java™ tutorials essential classes -...Louis Slabbert
 
Requirements to get full credits in Documentation1.A descripti
Requirements to get full credits in Documentation1.A descriptiRequirements to get full credits in Documentation1.A descripti
Requirements to get full credits in Documentation1.A descriptianitramcroberts
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdfvenud11
 
java150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptxjava150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptxBruceLee275640
 
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...vekariyakashyap
 

Similar to You can look at the Java programs in the text book to see how commen (20)

Unit Testing using PHPUnit
Unit Testing using  PHPUnitUnit Testing using  PHPUnit
Unit Testing using PHPUnit
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Php unit (eng)
Php unit (eng)Php unit (eng)
Php unit (eng)
 
Understanding Annotations in Java
Understanding Annotations in JavaUnderstanding Annotations in Java
Understanding Annotations in Java
 
Ppt on java basics1
Ppt on java basics1Ppt on java basics1
Ppt on java basics1
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdf
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
 
I really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdfI really need help on this question.Create a program that allows t.pdf
I really need help on this question.Create a program that allows t.pdf
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Test Presentation
Test PresentationTest Presentation
Test Presentation
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Setup Java Path and classpath (from the java™ tutorials essential classes -...
Setup Java Path and classpath (from the java™ tutorials   essential classes -...Setup Java Path and classpath (from the java™ tutorials   essential classes -...
Setup Java Path and classpath (from the java™ tutorials essential classes -...
 
Laravel Unit Testing
Laravel Unit TestingLaravel Unit Testing
Laravel Unit Testing
 
Requirements to get full credits in Documentation1.A descripti
Requirements to get full credits in Documentation1.A descriptiRequirements to get full credits in Documentation1.A descripti
Requirements to get full credits in Documentation1.A descripti
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdf
 
java150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptxjava150929145120-lva1-app6892 (2).pptx
java150929145120-lva1-app6892 (2).pptx
 
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
 

More from anitramcroberts

Propose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docxPropose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docxanitramcroberts
 
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docxProsecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docxanitramcroberts
 
PromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docxPromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docxanitramcroberts
 
Property TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docxProperty TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docxanitramcroberts
 
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docxProsecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docxanitramcroberts
 
Prompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docxPrompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docxanitramcroberts
 
Properties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docxProperties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docxanitramcroberts
 
Proofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docxProofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docxanitramcroberts
 
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docxProof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docxanitramcroberts
 
prompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docxprompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docxanitramcroberts
 
Prompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docxPrompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docxanitramcroberts
 
PromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docxPromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docxanitramcroberts
 
PromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docxPromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docxanitramcroberts
 
PromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docxPromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docxanitramcroberts
 
PROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docxPROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docxanitramcroberts
 
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docxPrompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docxanitramcroberts
 
PromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docxPromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docxanitramcroberts
 
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docxPrompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docxanitramcroberts
 
Project This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docxProject This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docxanitramcroberts
 
ProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docxProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docxanitramcroberts
 

More from anitramcroberts (20)

Propose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docxPropose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docx
 
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docxProsecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
 
PromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docxPromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docx
 
Property TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docxProperty TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docx
 
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docxProsecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docx
 
Prompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docxPrompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docx
 
Properties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docxProperties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docx
 
Proofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docxProofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docx
 
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docxProof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docx
 
prompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docxprompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docx
 
Prompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docxPrompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docx
 
PromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docxPromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docx
 
PromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docxPromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docx
 
PromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docxPromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docx
 
PROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docxPROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docx
 
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docxPrompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docx
 
PromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docxPromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docx
 
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docxPrompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
 
Project This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docxProject This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docx
 
ProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docxProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docx
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 

You can look at the Java programs in the text book to see how commen

  • 1. 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) Movie.java (No need to modify, modified version from the assignment 4) Review.java (No need to modify) CreatePane.java - to be completed ReviewPane.java - to be completed You might need to add more methods than the specified ones. Skills to be Applied: JavaFX, ArrayList Classes may be needed: Button, TextField, TextArea, Label, RadioButton, ListView, and ActionHandler. You may use other classes.
  • 2. Here is the Assignmnet6.java: import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.StackPane; import java.util.ArrayList; public class Assignment6 extends Application { private TabPane tabPane; private CreatePane createPane; private ReviewPane reviewPane; private ArrayList movieList; public void start(Stage stage) {
  • 3. StackPane root = new StackPane(); //movieList to be used in both createPane & reviewPane movieList = new ArrayList(); reviewPane = new ReviewPane(movieList); createPane = new CreatePane(movieList, reviewPane); tabPane = new TabPane(); Tab tab1 = new Tab(); tab1.setText("Movie Creation"); tab1.setContent(createPane); Tab tab2 = new Tab(); tab2.setText("Movie Review"); tab2.setContent(reviewPane); tabPane.getSelectionModel().select(0); tabPane.getTabs().addAll(tab1, tab2); root.getChildren().add(tabPane);
  • 4. Scene scene = new Scene(root, 700, 400); stage.setTitle("Movie Review Apps"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } Here is Movie.java: public class Movie { private String movieTitle; private int year; private int length; private Review bookReview;
  • 5. //Constructor to initialize all member variables public Movie() { movieTitle = "?"; length = 0; year = 0; bookReview = new Review(); } //Accessor methods public String getMovieTitle() { return movieTitle; } public int getLength() { return length;
  • 6. } public int getYear() { return year; } public Review getReview() { return bookReview; } //Mutator methods public void setMovieTitle(String aTitle) { movieTitle = aTitle; } public void setLength(int aLength) {
  • 7. length = aLength; } public void setYear(int aYear) { year = aYear; } public void addRating(double rate) { bookReview.updateRating(rate); } //toString() method returns a string containg the information on the movie public String toString() { String result = "nMovie Title:tt" + movieTitle + "nMovie Length:tt" + length + "nMovie Year:tt" + year
  • 8. + "n" + bookReview.toString() + "nn"; return result; } } Here is Review.java: import java.text.DecimalFormat; public class Review { private int numberOfReviews; private double sumOfRatings; private double average; //Constructor to initialize all member variables public Review() { numberOfReviews = 0; sumOfRatings = 0.0;
  • 9. average = 0.0; } //It updates the number of REviews and avarage based on the //an additional rating specified by its parameter public void updateRating(double rating) { numberOfReviews++; sumOfRatings += rating; if (numberOfReviews > 0) { average = sumOfRatings/numberOfReviews; } else average = 0.0; } //toString() method returns a string containg its review average //and te number of Reviews
  • 10. public String toString() { DecimalFormat fmt = new DecimalFormat("0.00"); String result = "Reviews:t" + fmt.format(average) + "(" + numberOfReviews + ")"; return result; } } Here is CreatePane.java: import java.util.ArrayList; import javafx.scene.layout.HBox; //import all other necessary javafx classes here //---- public class CreatePane extends HBox { private ArrayList movieList;
  • 11. //The relationship between CreatePane and ReviewPane is Aggregation private ReviewPane reviewPane; //constructor public CreatePane(ArrayList list, ReviewPane rePane) { this.movieList = list; this.reviewPane = rePane; //Step #1: initialize each instance variable and set up the layout //---- //create a GridPane hold those labels & text fields //consider using .setPadding() or setHgap(), setVgap() //to control the spacing and gap, etc. //----
  • 12. //You might need to create a sub pane to hold the button //---- //Set up the layout for the left half of the CreatePane. //---- //the right half of this pane is simply a TextArea object //Note: a ScrollPane will be added to it automatically when there are no //enough space //Add the left half and right half to the CreatePane //Note: CreatePane extends from HBox //---- //Step #3: register source object with event handler //----
  • 13. } //end of constructor //Step 2: Create a ButtonHandler class //ButtonHandler listens to see if the button "Create a Movie" is pushed or not, //When the event occurs, it get a movie's Title, Year, and Length //information from the relevant text fields, then create a new movie and add it inside //the movieList. Meanwhile it will display the movie's information inside the text area. //It also does error checking in case any of the textfields are empty or non-numeric string is typed private class ButtonHandler implements EventHandler { //Override the abstact method handle() public void handle(ActionEvent event) { //declare any necessary local variables here //---
  • 14. //when a text field is empty and the button is pushed if ( //---- ) { //handle the case here } else //for all other cases { //---- //at the end, don't forget to update the new arrayList //information on the ListView of the ReviewPane //---- //Also somewhere you will need to use try & catch block to catch //the NumberFormatException } } //end of handle() method
  • 15. } //end of ButtonHandler class } Here is ReviewPane.java import javafx.scene.control.ListView; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.layout.VBox; import javafx.event.ActionEvent; //**Need to import to handle event import javafx.event.EventHandler; //**Need to import to handle event import java.util.ArrayList; import javafx.scene.layout.HBox; //import all other necessary javafx classes here //---- public class ReviewPane extends VBox
  • 16. { private ArrayList movieList; //A ListView to display movies created private ListView movieListView; //declare all other necessary GUI variables here //---- //constructor public ReviewPane(ArrayList list) { //initialize instance variables this.movieList = list; //set up the layout //---- //ReviewPane is a VBox - add the components here
  • 17. //---- //Step #3: Register the button with its handler class //---- } //end of constructor //This method refresh the ListView whenever there's new movie added in CreatePane //you will need to update the underline ObservableList object in order for ListView //object to show the updated movie list public void updateMovieList(Movie newMovie) { //------- } //Step 2: Create a RatingHandler class
  • 18. private class RatingHandler implements EventHandler { //Override the abstact method handle() public void handle(ActionEvent event) { //When "Submit Review" button is pressed and a movie is selected from //the list view's average rating is updated by adding a additional //rating specified by a selected radio button if (//----) { //---- } } } //end of RatingHandler } //end of ReviewPane class