


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Objective
index, and trade the card in the current Hand at that index for the Card object passed in as a parameter. Your Hand class should have a toString method. Also, your Hand class should have a compareTo method that implements the Comparable interface. (This is the method that will be used to determine who between two players has a better hand.) Game This class will have your main method and any other methods you deem necessary. The instance variables of this class will be one Deck object and two Hand objects. One of the Hand objects will belong to the user while the other will be the computer’s hand. In your main method, you will instantiate a Game object, and then allow the user to play a single game of Poker against the Computer. This game will consist of showing the user the five cards they were dealt, asking them how many they want to switch out (which is guaranteed to be an integer in between 0 and 5 inclusive), then asking them which cards they want to replace, and finally replacing those cards with the top cards from the Deck and then printing out to the screen whether or not the user won, along with both the user’s cards and the computer’s cards. Simplified Rules for Poker In this version of poker, the only type of hand that is worth anything is multiple cards of the same kind. Here’s how the winner between two Hand objects is determined:
Deliverables You must submit a solution to the program described above in four files named Card.java, Deck.java, Hand.java and Game.java over WebCT. Restrictions You must use a Java 5.0 compiler to develop your program. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include ample comments throughout your code describing the major steps in solving the problem. Grading Details Your program will be graded upon the following criteria: