Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make sure the output looks like the example given. Make sure all requirements are met. This is to be done in JAVA. program a

Please make sure the output looks like the example given. Make sure all requirements are met. This is to be done in JAVA.

image text in transcribedimage text in transcribedimage text in transcribed

program a "Multi-Game Winner" consisting of the following 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 each new game a new set of Player and Staff 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 e The system provides a winner per game, and then an overall winner for all games. B.1 Package "person" The person package contains the PrintData interface and three java classes Person, Player, and Staff B.1.1 PrintData Interface The PrintData interface is defined as follows public interface PrintData public void printId public void printVal ( B.1.2 Person Abstract Class The Person abstract class defines common functionality to Player and Staff subclasses B.1.3 Player and Staff Classes The Player and Staff subclasses store specific information to each subclass and override the printing methods specified in the PrintData interface. You can assign to these classes additional methods B.2 Package "game" The game package contains the Winner class B.2.1 Winner Class The Winner class contains the following functionality The main Java method containing the following code public static void main (String[] args) . Winner w-new Winner ) Person [ winnersArraynew Person [numRuns] Person [] personArray-new Person [numPerson] for (int x=0; x Id from Game where corresponds to the game number starting from 0 corresponds to either Player or Staff corresponds to either or type sval> s to either or 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 program a "Multi-Game Winner" consisting of the following 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 each new game a new set of Player and Staff 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 e The system provides a winner per game, and then an overall winner for all games. B.1 Package "person" The person package contains the PrintData interface and three java classes Person, Player, and Staff B.1.1 PrintData Interface The PrintData interface is defined as follows public interface PrintData public void printId public void printVal ( B.1.2 Person Abstract Class The Person abstract class defines common functionality to Player and Staff subclasses B.1.3 Player and Staff Classes The Player and Staff subclasses store specific information to each subclass and override the printing methods specified in the PrintData interface. You can assign to these classes additional methods B.2 Package "game" The game package contains the Winner class B.2.1 Winner Class The Winner class contains the following functionality The main Java method containing the following code public static void main (String[] args) . Winner w-new Winner ) Person [ winnersArraynew Person [numRuns] Person [] personArray-new Person [numPerson] for (int x=0; x Id from Game where corresponds to the game number starting from 0 corresponds to either Player or Staff corresponds to either or type sval> s to either or 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions