Hello everyone i have this assignment and i am requesting fo
Hello everyone, i have this assignment and i am requesting for the answer. If any one knows it please let me know. I already have the file just let me know where to insert
Description:
 The purpose of this assignment is to build an application that
 1. Locates a .quiz file on your hard drive and opens it 2. Reads each of the objects in that file into an array (for easier handling) 3. Each object contains a question and an array of possible answers, along with the correct answer, the difficulty level, the number of points awarded, etc. Therefore, each pane will need to display this information into the pane 4. The code loops through the array of objects, and on each iteration displays a new Q/A combination. The program terminates when the questions are finished, and displays the number of correct responses out of the total number of questions asked.   
 
  Assignment 1
  Page 1
 Assignment 1 QuizMaster (Part 1)
 I. Load the code for this lab, available on Blackboard, into a new project.   
 a. In Eclipse, create a new project called Assignment1
 b. Download Assignment1.zip from Blackboard and open the contents into a package called cst8284.quizMaster.
 II. Review the files in Assignment1.zip and make sure you understand their purpose
 There are four files included with this assignment, which you must use, and which you must submit with your finished assignment.
 a) QuizMain is the main point of entry for your program. It performs three main actions: it loads a simple splash pane (given); it opens the file containing the Q/A objects and loads them into an array, and then loops through the array loading each question into a BorderPane with separate sections for the question, answers, and explanation; and finally displays the results of the quiz.
 Note that each of the three sections is associated with a method that loads up a different Pane object. getSplashPane() loads a simple text message (“Welcome to QuizMaster”) for initial display in the centre of a BorderPane. getCurrentQAPane() uses the current QA object to load up a BorderPane with some of the components of the QA object. getResultsPane() displays the results of the quiz. getSplashPane() is provided for you; more
 information on the other two panes is provided below.
 b) FileUtils is a class containing static methods that perform basic file I/O operations, including checking to see if the file exists, returning the file name, and so on. The static method getFileHandle() calls up the FileChooser dialog box, shown below, which prompts the user to select a .quiz file (to be provided), which contains the QA objects to be loaded. Note that the other utilities in this class rely on a file having been correctly selected. If the ‘Cancel’ button on the dialog is selected, then no file handle is returned from getFileHandle(), and any further attempts to return a path name to the file return an empty string.
 Therefore, you must modify QuizMain to prompt the user, should they chose NOT to locate a .quiz file through the above dialog box, whether they wish to continue or not. This can be done using an Alert dialog, such as the one shown below. (See, for example, https://docs.oracle.com/javase/8/javafx/api/jav afx/scene/control/Alert.html or http://wwwacad.sheridanc.on.ca/~jollymor/prog24178/ja vafx7.html assistance.)
  Assignment 1
  Page 2
 If they do wish to continue, then prompt them with the above dialog again, otherwise execute Platform.exit() to exit the program.
 The code in FileUtils is mostly complete, with the exception of the getQAArray() method, which you’ll need to supply. This method reads in the absolute path of the file returned from getFileHandle()—you can use getFileName() to return this string, assuming it was correctly supplied by the user—and loads each object into an array of QA objects, which gets returned to the user.
 c) QuesAns is an abstract class that lists the abstract methods required elsewhere in your program.
 d) QA extends QuesAns and supplies concrete methods. Use the QA class when you need to load the QA objects from the .ques file returned by getFileHandle(), as indicated above in part (b), and when you need to load the currentQAPane, as indicated below
 III.Supply the classes/methods required to allow for the correct execution of your program
 a. Pseudocode for QuizMain is as follows:   
 LOAD splashScreen DISPLAY splashScreen
 PROMPT getFileName LOAD QAArray WITH QAfile
 FOR (QAArray.length) LOAD currentQA into Pane DISPLAY currentQAPane PAUSE FOR USER INPUT END FOR
 DISPLAY resultsPane   
 Note that the method FileUtils.showAndWait(FileUtil s.ON) effectively pauses the program to give the user time to input a response. Without such a mechanism, the enhanced for loop that drives the program would simply loop through and load every pane in rapid succession, with no way to allow the user time to read questions and select answers. There are better ways to perform this operation, but they involve code that is beyond our reach just now. For now, showAndWait() does the job. Therefore, when the user wishes to move on to the next question, the NEXT QUESTION button must execute FileUtils.showAndWait(FileUtil es.OFF), to allow the program to load the next QA object in the loop.
 Also note that, for demonstration purposes, the .ques file will only contain MAX_QA_SIZE questions (initially set to 5); hence we only load MAX_QA_SIZE objects into the array, and loop through the enhanced for loop MAX_QA_SIZE times. This will change in Assignment 2 when we modify this code to accommodate files of any size.
 b. Aside from the getQAArray code needed to complete the FileUtils class, along with the code needed to display the results at the end of the program, most of your time will be spent writing the code needed to display the current Question/Answers combination.
 The getCurrentPane() method, which reads in the currentQA object, should be included in QuizMain, along with the two other ‘getPane()’ methods needed for proper execution of the program.
 Your QA input pane should look something like the screenshot shown in the figure below.
  Assignment 1
  Page 3
 Note however that you have considerably flexibility in how you choose to present this information, including which type of pane(s) you use, which fonts, etc. There are some things which you must do however:
 i. The output should be positioned in the middle of the window ii. The text output should maintain its general features when resized (e.g. to full screen) iii. When the Check Answer button is selected, it should indicate in the space below the answers (a) which answer is correct, displaying the currentQA.explanation() String into the bottom of the screen to explain why the answer was correct or incorrect (not shown above). iv. In the Next Question event handler, set FileUtils.waitAndShow(OFF). This should allow your program to move on to the next QA object, thereby loading the next question into the pane. v. You must use Radio Buttons for the Answers section of the pane, and this will require that you construct a new
 class, called AnswerPane, described next.
 c. The AnswerPane class stores all the information needed to load and display the answers, as well as record which one of the radio buttons was selected. The UML diagram for AnswerPane is shown below.
 Note the follow features of AnswerPane:
 i. It contains four private members, including: an array of strings corresponding to the array of possible answers; an array of radio buttons
 -answerBox: VBox -group: ToggleGroup -rbAr: RadioButton[] -answers: String[]
 +AnswerPane(answers: String[])
 +getAnswerPane(): VBox +getButtonSelected(): int
 AnswerPane
  Assignment 1
  Page 4
 whose number will be determined by the number of answers in the array of Strings just mentioned; a ToggleGroup object, which is a container for the radio buttons (see below); and a VBox, which aligns the radio buttons, togglebox, and strings, and its returned by the getAnswerPane() method for display.
 ii. The AnswerPane() constructor takes in an array of strings corresponding to the answers for each question. You do not need a no-arg constructor, as this class will not be extended in a subclass (you need to ensure this in your code— how?)
 iii. getAnswerPane() adds radio buttons to the answerBox pane and returns the answerBox pane to the calling program. The number of radio buttons will be equal to the number of answers in string supplied with the AnswerPane() constructor. Each radio button must be part of the ToggleGroup previously mention. (A ToggleGroup ensures that only one button can be selected at any time. Thus this program is not designed to handle multiple answers, only single answers.) For information on adding radio buttons to a toggle group, see the section ‘Radio Button Groups’ at http://www.java2s.com/Tutorials/Java/Jav aFX/0420__JavaFX_RadioButton.htm.
 Note that you do not need to implement a Listener/Event Handler for this control, since the getButtonSelected() method can be used to return the final choice made by the user at the time when the Check Answer button is clicked (see next).
 iv. The getButtonSelected() method should loop through the array of radio buttons and use the radio button’s
 isSelected() property to determine which button was chosen by the user.
 d. The Check Answer button is not part of the AnswerPane, however it relies on an instance of the AnswerPane object to (1) get the answer selected by the user using getButtonSeleted() (2) compare this with the correct answer, as provided by the QA object (3) store the result in the QA object using the setResult() method, true if the answer was correct and false otherwise (4) Load the response string beneath the answers so the user can check the results.
 e. The resultsPane() loops through each QA object reports constructs a text string for display in the pane returned by this method. The text should indicate (1) the question number (2) whether the answer with CORRECT or WRONG, and (3) at the very end, the total score, based on the total number of correct answers divided by the total number of questions, e.g. “7/10”   
 IV. Notes
 a. You have considerable leeway in determining the layout of your Javafx application, provided it conforms to certain standards, as indicated in the previous section. To help you with the formatting, you should consult various internet sources. The following may prove valuable:
 http://docs.oracle.com/javafx/2/layout/siz e_align.htm
 http://stackoverflow.com/questions/2616 9445/how-do-i-center-javafx-controls
 http://stackoverflow.com/questions/1608 3683/button-alignment-in-javafx
 http://tutorials.jenkov.com/javafx/gridpan e.html
  Assignment 1
  Page 5
 b. You only need to implement two EventHandlers, one for each of the two rectangular buttons shown in the previous figure (their code is straightforward and has already been described above.) You will find that using lambda expressions simplifies this process considerably, but you are under no requirements to do so; use inner classes if you wish.
 c. As stated previously, you do not need to implement an EventHandler/Listener for the radio buttons, since we are only concerned with the user’s final choice at the time they select the Check Answer button.
 d. You can partially test your code without the file of QA objects by instantiating a new QA object using the QA constructor supplied, and then passing it to getCurrentQAPane(). In other words, comment out the for loop, and test your code using a single QA object, before testing you code with a file of QA objects.
 e. Note that you must cite any and all web pages that you use in researching your code according to the guidelines outlined in Module 0 of this course. Failure to do so could result in a charge of plagiarism and disciplinary action.   
 V. Bonus Marks
 Bonus Marks will be awarded for either of the following attempts. Please be sure to clearly indicate if you intend to make an attempt on any or all of the bonus questions by adding a text or word document stating which of the following bonus questions you’ve attempted.
 I. Two bonus marks will be awarded for particularly good layouts, i.e. where the formatting of the QA pane is particularly
 well thought out, and where the student has clearly done research into the styling and structure of the layout.
 II. Three bonus marks will be awarded for a detailed, cogent analysis of the FileExists() method. You must address the following questions: a. What is the difference between using ‘&’ and ‘&&’ in this code? b. What is this process (i.e. what happens when you use ‘&&’ instead of ‘&’) called? c. How does this affect the execution of the single line of code in the FileExists() method? What happens if you use ‘&’ instead of ‘&&’, and why? d. What would happen if you changed the order in which the various File methods were evaluated, i.e. if, say, isFile() was evaluated before the exists() method? This can be supplied on a document separate from your code, according to the submission guidelines.  
Solution
‘&’ is the bitwise AND operator. For operands of integer types, it will calculate the bitwise-AND of the operands and the result will be an integer type.
For Boolean operands, it will compute the logical and of operands.
‘&&’ is the logical AND operator and does not work on integer types. For Boolean types, where both of them can be applied.
The difference using ‘&&’ instead of ‘&’ is in the \"short-circuiting\" property of &&. If the first operand of ‘&&’ evaluates to False the second is not evaluated at all. This is not the case for ‘&’
2.what happens when you use ‘&&’ instead of ‘&’
Java finds the value on the left side of an && operator to be false, then Java gives up and declares the entire expression to be false. That\'s called short circuit expression evaluation.
3)Affect the execution of the single line of code in the FileExists() method?



