[Solved]Goal Add Gui Based Javatx Also Including Exception Handling Description Follows Random Siz Q37068924


![int numPlayers0 int numstaff0 for (int i-0; i<pa.length; i++) I tmp = r.nextDouble() ; if (trp <= 0.5) numPlayerst+ pa [1] =](https://media.cheggcdn.com/media%2F6bf%2F6bf38463-52ea-4527-b4b6-f4481d22fd6a%2FphpEwRerZ.png)

—The goal is to add a GUI based on JavatX while also including exception handling. Description is as follows: A random sized personArray that stores objects of type Person. The personArray contains a random number of Player and Staff whose specific numbers may vary between games. During cach new game a new set of Playcr and Staf objects need to be created and stored in the array A random sized winnersArray that stores objects of type Person storing every game winner. This array may be of different size than personArray .The system provides a winner per game, and then an overall winner for all games The GUI must include the following functionality: (1) a text entry with a button to input the arbitrary lengths of personArray and winnerArray, (2) a button or menu to initialize the game (calling init game), (3) a button or menu to play the game (calling find_person_winner and find game_winner), and (4) a “TextArea” (or similar) to display all Winners .The program must handle the egal Argumentxception to manage any exceptions from non-numerical entries to set the size of the arrays in the GUI The GLI should permit re-initializing and re-playing of the game multiple times .You may design the GUI as you wish as long as it works and contains all the specified functionality . You may usc the Java code below as a starting point Package person” The person package contains the Person, Player, and Staff classes as described in the code below —Package game” The game package contains the Winner class, containing (1) the init game method where an arbitrary number of Player and Staff objects get instantiated for each game played, (2) A method called find person_winner returning the Person winner after each game, and (3) the find_game_winner returning the winner of all games -Package “gui” The gui package contains the GameGUI class where all JavaFX code is found. You may include multiple classes in this package -Program Output The program output inside the “TextArea” of the GUI is similar to that of the code below <Person> ldくspecificid> from Game <gameld>, Valueくval> <gameld> corresponds to the game number starting from 0 <Person> corresponds to either Player or Staff <specificld> corresponds to either <playerld> or <staffld> type specificTotal> corresponds to either <totalPlayerNum> or <totalStaftNum> val coresponds to a random value between 0 and 1 —Sample output: Game: 0 Staff Id 1 from Game O; Value 0.9413720497191768 Staff Id 2 from Game 0: Value O.12675823219989202 Player ld 1 from Game 0; Value 0.09728762044279848 Staff ld 3 from Game 0; Value 0.1825126176110694 Game Winner is: Staff Id 1 from Game 0: Value 0.9413720497191768 ame Player Id 1 from Game I; Value 0.3607839120647821 Staff ld 1 from Game 1; Value 0.764314784846852 Player ld 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 ame 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 ld 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 ld 2 from Game 3; Value 0.7515432842214887 Game Winner is: Staff Id 2 from Game 3: Value 0.9346865563493605 Game Winners Staff Id I from Game 0: Value 0.9413720497191768 Player Id 2 from Game 1; Value 0.8184547210782026 Player ld 2 from Game 2; Value 0.9341721291722334 Staff ld 2 from Game 3; Value 0.9346865563493605 All Game Winner is: Staff Id 1 from Game 0; Value 0.9413720497191768 –Java code package game import java.util.Random; //import java.util.Scanner; import person.*; class Winner static int nurn uns = 2; static int nurPerson 2; private Random r- new Random ) public static void main (string ] args) Winner w- new Winner ) Person [] winnersArraynew Person [numRuns]; Person] personArray new Person [numPerson]; for (int x=0; x<winnersArray.length ; x++) { System.out.println (“Game: “+x); w.init game (personArray,x); Person P = w.findperson winner (personarray) ; if (p!- null) – System. out.println (” Game Winner is: “; p.printVal ) winnersArray [x] =p ; Person win = w. find game winner(winnersArray) ; if (win != null) System.out.println(“All Game Winner is: “); win.printVal ); void init game (Person [] pa, int x) f double tmp – 0 int numPlayers0 int numstaff0 for (int i-0; i<pa.length; i++) I tmp = r.nextDouble() ; if (trp <= 0.5) numPlayerst+ pa [1] = new Player (1,numPlayers , x): else numStaff+t pa [i ] = new staff ( í r numstaff , x): pa [i].printVal ); Person find person winner (Person[l pa) int id1 = 0, id2 = O; double vall – 0, val2 – 0 for (inti-o; ¡<pa·length ; i++) { id1 = pa [1] .getId() ; va11 = pa [1j, getVal ( ) ; if (vall > val2) val2 val1 ; id2 = id1; return pa [id2]; Person find game winner (Person [] pa) i double val 1-0, val2 = 0; System.out.println (“Game Winners: “).; for (inti-0; ǐくPa.length ; ¡++) { id1 – i; // pa[i] .getId; vall – pa[i].getVal ); pa [i] printVal); if (vall > val2) 1 return pa[id2]; package person; import java.util.Random; public abstract class Person implements PrintData ( private Random 1 – new Random ) private int id = 0; private double val0 private int game 0 public Person (int i,int x) i id – i; game xi val – r.nextDouble); public String toString) t return ” Valu+ val // public abstract void printId) // public abstract void printVal) public void printId) l System.out.println(” Person Id ” + id); public void printVal) System.out.print(” Person Id ” + id + ” from Game”+game + “;”); System.out.println (tostring )) public int getId) return id; public double getVal) ( return val; public int getGame) return game; package person; public class Player extends Person private int playerId – 0 public Player (int i,int num,int x) i super (i.x); playerid = num ; public void printld) l System.out.println(” Player Id “+ playerId); public void printVal ) i System.out.print( Player Id ” + plaverId System.out.println (tostring) from GamegetGame) package person; public interface PrintData public void printId): public void printval0; package person; public class Staff extends Person [ private int staffId – 0; public Staff (int i,int num,int x) I super (i,x); staffId – num; public void printId ) System.out.println(” Staff Id “+ staffId); public void printVal) i System.out.print(” Staff Id ” + staffId +” from Game” +getGame) + “;”) System.out.println (tostring) Show transcribed image text —The goal is to add a GUI based on JavatX while also including exception handling. Description is as follows: A random sized personArray that stores objects of type Person. The personArray contains a random number of Player and Staff whose specific numbers may vary between games. During cach new game a new set of Playcr and Staf objects need to be created and stored in the array A random sized winnersArray that stores objects of type Person storing every game winner. This array may be of different size than personArray .The system provides a winner per game, and then an overall winner for all games The GUI must include the following functionality: (1) a text entry with a button to input the arbitrary lengths of personArray and winnerArray, (2) a button or menu to initialize the game (calling init game), (3) a button or menu to play the game (calling find_person_winner and find game_winner), and (4) a “TextArea” (or similar) to display all Winners .The program must handle the egal Argumentxception to manage any exceptions from non-numerical entries to set the size of the arrays in the GUI The GLI should permit re-initializing and re-playing of the game multiple times .You may design the GUI as you wish as long as it works and contains all the specified functionality . You may usc the Java code below as a starting point Package person” The person package contains the Person, Player, and Staff classes as described in the code below —Package game” The game package contains the Winner class, containing (1) the init game method where an arbitrary number of Player and Staff objects get instantiated for each game played, (2) A method called find person_winner returning the Person winner after each game, and (3) the find_game_winner returning the winner of all games -Package “gui” The gui package contains the GameGUI class where all JavaFX code is found. You may include multiple classes in this package -Program Output The program output inside the “TextArea” of the GUI is similar to that of the code below ldくspecificid> from Game , Valueくval> corresponds to the game number starting from 0 corresponds to either Player or Staff corresponds to either or type specificTotal> corresponds to either or val coresponds to a random value between 0 and 1 —Sample output: Game: 0 Staff Id 1 from Game O; Value 0.9413720497191768 Staff Id 2 from Game 0: Value O.12675823219989202 Player ld 1 from Game 0; Value 0.09728762044279848 Staff ld 3 from Game 0; Value 0.1825126176110694 Game Winner is: Staff Id 1 from Game 0: Value 0.9413720497191768 ame Player Id 1 from Game I; Value 0.3607839120647821 Staff ld 1 from Game 1; Value 0.764314784846852 Player ld 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
ame 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 ld 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 ld 2 from Game 3; Value 0.7515432842214887 Game Winner is: Staff Id 2 from Game 3: Value 0.9346865563493605 Game Winners Staff Id I from Game 0: Value 0.9413720497191768 Player Id 2 from Game 1; Value 0.8184547210782026 Player ld 2 from Game 2; Value 0.9341721291722334 Staff ld 2 from Game 3; Value 0.9346865563493605 All Game Winner is: Staff Id 1 from Game 0; Value 0.9413720497191768 –Java code package game import java.util.Random; //import java.util.Scanner; import person.*; class Winner static int nurn uns = 2; static int nurPerson 2; private Random r- new Random ) public static void main (string ] args) Winner w- new Winner ) Person [] winnersArraynew Person [numRuns]; Person] personArray new Person [numPerson]; for (int x=0; x
Expert Answer
Answer to —The goal is to add a GUI based on JavatX while also including exception handling. Description is as follows: A random… . . .
OR

