Question: Class BitArray Property of BitArray -boolean[5] Constructor of BitArray: Define a contructor + BitArray (boolean b0, boolean b1, boolean b2, boolean b3, boolean b4) Methods

Class BitArray Property of BitArray -boolean[5] Constructor of BitArray: Define a contructor + BitArray (boolean b0, boolean b1, boolean b2, boolean b3, boolean b4) Methods of BitArray: Define getters and setters methods fro the property

_______________________________ Class LFSR Properties of LFSR: - BitArray register - BitArray coefs (this property should be final) Constructor of LFSR: define a constructor which takes two BitArray: one for the register and one for the coefs Methods of LSFR: +void updateLSFR() {} which: -computes the feedback from the register and the coefs (see old assignement correction) -shifts the register TO THE LEFT (for example register[1]=register[2]) -stores the feedback at the end fo the array, that is in register[4]

+Getter and setters for register

_______________________________

In the main method of the Main Class: initialize an object lfsr of type LFSR with initialRegister [0,0,0,0,1] and coefs [1,0,1,0,0] create an object of type MyDeck using lfsr shuffle the deck of cards at leas one time create an ArrayList containing the 5 card picked by the volonteers (use the method distributeCards() of MyDeck)

Print the volonteers' card color (print them using the getColor() method) and store it into an object of type BitArray, named volonteersColors Use volonteersColors to guess the cards: re-initialize the lfsr by re-setting the register on the value volonteersColors. define an array Card[5] named guessingCards. The first card is created by using the Card constructor with BitArray parameter volonteersColors the successive 4 cards are obtained similarly, by updating the lfsr before each iteration

Check if it is correct: the elements of the list of cards created by distributedCard() should be the same as the ones in guessingCards print "Magic!" if the magic trick works

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!