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

  Is a java applet different than a java program

Is a Java Applet different than a Java program? Why do we need to write HTML code for a java Applet to run it? How do we test a Java Applet

  What are the three types of errors

What are the three types of errors that you can encounter in a Java program? Describe them, and explain how you would minimize the errors

  Write a program to test your class definition

Do not define an input method. The only method that can set the counter is the one that sets it to zero. Write a program to test your class definition.

  Create a messageframe class extending jframe

Create a MessageFrame class extending JFrame and a MessagePanel class extending JPanel.

  Total annual compensation policy to improve sales

The company has recently changed its total annual compensation policy to improve sales. A salesperson will continue to earn a fixed salary of $30,000. The current sales target for every salesperson is $400,000. Sales incentives are calculated as foll..

  Can we run java byte code on android since android

Can we run java byte code on android since android is also java based

  Write a method called rectsum

Write a method called rectSum that will get the sum of a rectangle of elements within a 2D array of ints

  Write a java program that finds the temperature

Write a JAVA program that finds the temperature that is the same in both Celsius and Fahrenheit.

  Write a program that reads in the file

Write a program that reads in the file and exports it to a standard CSV format. For the records above, the output format would be Freddy Kruger, 1313 Mockingbird Lane, Houston, Texas Billy Thornton, 1010 Slingblade Street, Houston, Texas

  Program that computes and prints the value of 6!/5! using

Write a Java program that computes and prints the  value of 6!/5! using Scanner.

  Program to calculate the discount amount and total

calculate the discount amount and total and format and display the results

  Java program on eclipse

Using a while( true ) loop,and using the upper case alphabeth from Z to A,print the lower case alphabeth and its corresponding ascii values.You must terminate/exit/break this loop once you process the last letter (A).

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