Question: Counter.java This class will be used to calculate the number of points from a Cribbage hand. The class must have the following private variables: -

 Counter.java This class will be used to calculate the number of

Counter.java This class will be used to calculate the number of points from a Cribbage hand. The class must have the following private variables: - PowerSet cardps - Card starter The class must have the following public methods: - public Counter(Card]] hand, Card starter): constructor - Initialize the starter and use the PowerSet constructor to generate the Power Set of the cards from the hand (note that the starter card is already included in the hand array so the Power Set will be based on all 5 cards. - public int countPoints() - Calculate the number of points for the hand that was sent into the constructor. Use the Power Set, cardps, to do the calculations so that all the combinations are checked. Refer to the scoring explanations in the Introduction when implementing this method. - It is recommended that you implement one or more private helper methods to help keep the code more organized and clean. For example, you may want private helper methods for each of the scoring categories, i.e. one for checking if a given Set sums to 15, another one to check if the given Set forms a run of 3 or more consecutive cards, etc

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!