Question: Write code for The Machine class should have the following methods: a public constructor that takes an int array for the game answer and an
Write code for The Machine class should have the following methods:
a public constructor that takes an int array for the game answer and an array of Verifiers.
a public constructor that takes an int array for game answer and a List of Verifiers.
Both constructors must check that the int array is a valid answer digits, all in the range from inclusive and invalid answers must throw an IncorrectDataException.
A toString method that overrides the standard toString and returns a String representing the list of available Verifiers. Details on the format of this are given below.
a public turn method that takes an int array as a guess and an array of char verifier choices, and returns a String describing the results of the guess. It throws an IncorrectDataException if the verifier does not exist, or the guess is out of bounds, or if the number of verifier checks isn't equal to Details on the format of this are given below.
a public turn method that takes an int array and a String of commaseparated verifiers and uses the same logic as turn described above.
a public method finalGuess that takes an int array, and returns true if the input matches the answer. It should throw an IncorrectDataException if the guess is out of bounds.
You will need to add private fields to help you complete these methods, particularly a data structure that holds the answer, and one to store the Verifiers.
Notice again that the verifier chars should be the first
n letters from A B C etc., where
n is the number of verifiers, Your code should handle both upper and lower case letters in the input.
You can also add other methods, but they should be private.
When Machine is converted to a StiVerifiers:
A Compares the nd digit to the value is it or
B Number of s in the code
C Checks the st digit compared to the nd ie xy
D If there is a number present exactly twicerng it should have the basic formal:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
