Question
NEEDS TO BE IN JAVA AND ALSO NEEDS TO BUILD AND RUN PLEASE For this homework you will make a class for a Player object.
NEEDS TO BE IN JAVA AND ALSO NEEDS TO BUILD AND RUN PLEASE
For this homework you will make a class for a Player object. This class should have the following instance variables:
player's name
player's score
an array of 5 integers to represent the value rolled by 5 (6 sided) dice
You should make the following methods for your class:
the default constructor
a constructor to initialize the players name and 5 int variables that are in the array data variable (they represent the dice values)
the setters and getters for all of the instance variables
a toString method that should output the value of all of the variables
an method with the following method header public int hasValue( int value) - this method should take in as a parameter a value of a dice (a number from 1-6) and return the number of dice that have that value
Make a test class that tests each method at least once.
USING JAVA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started