1. Engineering
  2. Computer Science
  3. java write a simple game program that utilizes the following...

Question: java write a simple game program that utilizes the following...

Question details

(Java) Write a simple game program that utilizes the following:

A. Requirements The assignment requires use of a Java IDE, such as Eclipse. You may use a different IDE (or no IDE) as long as you submit the src folder with all packages and java source files. B. Description The assignments goal is to program a simple game consisting of an arbitrary number of players. Each player has a unique numerical id and gets assigned a random value between 0 and 1. The player with the highest numerical value wins. B.1 Player Class Design a java class named Player that contains: A private int data field named id corresponding the player number (default 0) A private double data field named yal that stores a random value (default 0) A constructor that assigns initial values to id and val Two get methods that return the stored values for id and val . * B.2 Winner Class Design a java class named Winner that contains . The main Java method A method called init game where an array of players gets instantiated. The number of players needs to be specified as text input by using the Scanner class The method instantiates, i.e. constructs, all players with their id number and a random value between 0 and 1. The player array with all their ids and values needs to be printed A method called find winner where random values assigned to each player are compared and the player with the largest value gets printed as the winner. Printout should include corresponding player winner id and value

Answer uploaded as a screenshot of the class codes is preferred but not required.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution