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 (3 digits, all in the range from 1-5 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 3. Details on the format of this are given below.
a public turn method that takes an int array and a String of comma-separated 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 2nd digit to the value '3'(is it <3,=3 or >3?)
B) Number of 1s in the code
C) Checks the 1st digit compared to the 2nd (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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!