[Solved]Goal Program Game Gui Based Javafx Also Including Exception Handling Consisting Following Q37161112
—The goal is to program a game with a GUI based on JavaFXwhile also including exception handling, consisting of thefollowing:
• A random sized personArray that stores objects of type Person.The personArray contains a random number of Player and Staff whosespecific numbers may vary between games. During each new game a newset of Player and Staff objects need to be created and stored inthe array.
• A random sized winnersArray that stores objects of type Personstoring every game winner. This array may be of different size thanpersonArray.
• The system provides a winner per game, and then an overallwinner for all games.
• The GUI must include the following functionality: (1) a textentry with a button to input the arbitrary lengths of personArrayand winnerArray, (2) a button or menu to initialize the game(calling init_game), (3) a button or menu to play the game (callingfind_person_winner and find_game_winner), and (4) a “TextArea” (orsimilar) to display all winners.
• The program must handle the IllegalArgumentException to manageany exceptions from non-numerical entries to set the size of thearrays in the GUI.
• The GUI should permit re-initializing and re-playing of thegame multiple times.
• You may design the GUI as you wish as long as it works andcontains all the specified functionality.
—Package “person”
The person package contains the PrintData interface and thePerson, Player, and Staff classes.
—PrintData Interface
The PrintData interface is defined as follows:
public interface PrintData {
public void printId();
public void printVal();
}
—Person Abstract Class
The Person abstract class defines common functionality to Playerand Staff subclasses.
—Player and Staff Classes
The Player and Staff subclasses store specific information toeach subclass and override the printing methods specified in thePrintData interface. You can assign to these classes additionalmethods.
—Package “game”
The game package contains the Winner class, containing (1) themain method (2) a method called init_game where an arbitrary numberof Player and Staff objects get instantiated for each game played,(3) a method called find_person_winner returning the Person winnerafter each game, and (4) a method called find_game_winner returningthe winner of all games.
—Package “gui”
The gui package contains the GameGUI class where all JavaFX codeis found. You may include multiple classes in this package.
—Program Output
The program output inside the “TextArea” of the GUI should havethe following format (see sample output for additional printedinformation):
<Person> Id <specificId> from Game <gameId>;Value <val>
where
<gameId> corresponds to the game number starting from0.
<Person> corresponds to either Player or Staff
<specificId> corresponds to either <playerId> or<staffId> type
<specificTotal> corresponds to either<totalPlayerNum> or <totalStaffNum>
<val> corresponds to a random value between 0 and 1
—Sample output:
Game: 0
Staff Id 1 from Game 0; Value 0.9413720497191768
Staff Id 2 from Game 0; Value 0.12675823219989202
Player Id 1 from Game 0; Value 0.09728762044279848
Staff Id 3 from Game 0; Value 0.1825126176110694
Game Winner is:
Staff Id 1 from Game 0; Value 0.9413720497191768
Game: 1
Player Id 1 from Game 1; Value 0.3607839120647821
Staff Id 1 from Game 1; Value 0.764314784846852
Player Id 2 from Game 1; Value 0.8184547210782026
Player Id 3 from Game 1; Value 0.26964508660881936
Game Winner is:
Player Id 2 from Game 1; Value 0.8184547210782026
Game: 2
Player Id 1 from Game 2; Value 0.5013968226832225
Staff Id 1 from Game 2; Value 0.9243218748286065
Staff Id 2 from Game 2; Value 0.892060295283974
Player Id 2 from Game 2; Value 0.9341721291722334
Game Winner is:
Player Id 2 from Game 2; Value 0.9341721291722334
Game: 3
Staff Id 1 from Game 3; Value 0.05318193196716425
Staff Id 2 from Game 3; Value 0.9346865563493605
Player Id 1 from Game 3; Value 0.742478514800904
Player Id 2 from Game 3; Value 0.7515432842214887
Game Winner is:
Staff Id 2 from Game 3; Value 0.9346865563493605
Game Winners:
Staff Id 1 from Game 0; Value 0.9413720497191768
Player Id 2 from Game 1; Value 0.8184547210782026
Player Id 2 from Game 2; Value 0.9341721291722334
Staff Id 2 from Game 3; Value 0.9346865563493605
All Game Winner is:
Staff Id 1 from Game 0; Value 0.9413720497191768
Expert Answer
Answer to —The goal is to program a game with a GUI based on JavaFX while also including exception handling, consisting of the f… . . .
OR

