Develop a program that plays "five card stud"

Assignment Help JAVA Programming
Reference no: EM13941449

Develop a program that plays "Five Card Stud". The user plays agains the computer. The program will "deal" five cards to the user and itself. Whoever has the highest hand wins. Inform the user who has won that hand, and ask if the user wants to play again. Interaction is as follows:

Your hand is:
2 of hearts
3 of diamonds
4 of clubs
2 of clubs
3 of hearts

My hand is:
Ace of clubs
Ace of hearts
Ace of diamonds
King of clubs
King of hearts

I win, sorry...

Play again (y,n)? n

Thanks for playing.

You need to develop 4 classes for this program. They are the Card, Deck, and Hand classes and the class containing your main method.

The Card class must contain (at least) the following methods:

Card() - constructor that initialized the value and suit of the Card
getValue() - returns the current value of the Card
getSuit() - returns the current suit of the Card

equals() - returns true when the passed Card is equal to the current Card
compareTo() - compares two Cards (passed and current) returning -1, 0 or 1
toString() - returns the string representation of the current Card, i.e. "King of hearts"

The Deck class must contain (at least) the following methods:

Deck() - constructor that initializes the Deck of Cards
shuffle() - shuffles the Deck
deal() - returns the Card on the top of the Deck

Implement the Deck as an array of Cards.

The Hand class must contain (at least) the following methods:

equals() - returns true when the passed Hand is equal to the current Hand
compareTo() - compares two Hands (passed and current) returning -1, 0 or 1
toString() - returns the string representation of the current Hand, i.e. "King of heartsn2 of clubsn etc..."

Implement the Hand as an array of five Cards.

The fourth class is your main method class. It is implemented procedurally.

Reference no: EM13941449

Questions Cloud

Opportunity to demonstrate knowledge and skills : The project provides an opportunity to demonstrate knowledge and skills in conducting a  work analysis.
Describe the production cycle of beef cattle : Describe the production cycle of beef cattle. What does it take to be a successful beef cattle producer? Things you may want to consider: how females and bull should be cared for and managed, how calves should be managed, etc
State your chosen company and project overview : Restate your chosen company and project overview - Wrap the report up in a couple of sentences, stating your overall progress and affirming that you are on track or have a plan for catching up.
What are some factors that drive up the price of gold : What are some factors that drive up the price of gold? What are factors that drive it down?
Develop a program that plays "five card stud" : Develop a program that plays "Five Card Stud". The user plays agains the computer. The program will "deal" five cards to the user and itself. Whoever has the highest hand wins. Inform the user who has won that hand, and ask if the user wants to pl..
The expected return on a portfolio : The expected return on a portfolio: can never exceed the expected return of the best performing security in the portfolio. must be equal to or greater than the expected return of the worst performing security in the portfolio.
Corporate culture and hr management in multinational : Based on the information sourced in your research how would Hofstede's dimensions influence corporate culture and HR management in multinational T&H organisations based in your chosen country?
What was the average real return on the stock : You’ve observed the following returns on Doyscher Corporation’s stock over the past five years: –28.8 percent, 16.2 percent, 35.4 percent, 3.6 percent, and 22.6 percent. The average inflation rate over this period was 3.36 percent and the average T-b..
Does increase in immigration lead to an increase in crime : An increase in immigration may lead to an increase in different types of criminal activitydescribe and summarize the data sources that deals with research question above and examined.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Assignmentwrite a gui-based application that allows a user

assignmentwrite a gui-based application that allows a user to play a simple trivia game. the game should have 5

  Create four classes that must all interact

You will create four classes that must all interact in some meaningful way. In order to start you will create a class diagram to determine which classes depend on other classes and what those classes are

  Use the testcircle.java program to test your classes

Create a new class, Point, which inherits from Shape and contains two private instance variables of type int, x and y, which store the coordinates for the Point

  Compute and display the monthly payment

Compute and display the monthly payment -  programming problem can be solved by a program that performs three basic tasks-Input Data, Process Data, and Output Results.

  Write a java application using netbeans ide

Write a Java application using NetBeans Integrated Development Environment (IDE) or jGROUP IDE that calculates the total annual compensation of a salesperson

  An array of integers and returns the range of values

Write a method called range that accepts an array of integers and returns the range of values in the array. The range is defined as 1 more than the difference between the maximum and minimum values in the array. For example, if an array called list c..

  A game of tic-tac-toe

A game of tic-tac-toe, two players (one the computer) take turns marking an available cell in a 3 X 3 grid (a two dimensional array) with their respective tokens (either and X or an O). When one player has placed three tokens in a horizontal

  Create a bar chart that illustrates sales.

Hal's Used Cars has four salespeople named Pam, Leo, Kim, and Bob. Accept values for the number of cars sold by each salesperson in a month, and create a bar chart that illustrates sales. Save the file as BarGraph.java.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Prepare executable programs a translate program and a

prepare executable programs. a translate program and a dictionary program. the programs will be written in any

  Returns the object with the largest measure

public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of

  On any given execution your program

On any given execution your program will produce just one version of the figure. However, you should refer to the class constant throughout your code, so that by simply changing your constant's value and recompiling, your program would produce a f..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd