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

  An n n matrix is called a positive markov matrix

An n n matrix is called a positive Markov matrix if each element is positive and the sum of the elements in each column is 1. Write a program MarkovMatrix.java that prompts the user to enter a 33 matrix of double values. Use a method with the followi..

  Determine whether the five-digit input was odd or even

inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each.

  Calculates the total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment IDE that calculates the total annual compensation of a salesperson.

  State a java class named accumulator the class comprises

question define a java class named accumulator. the class contains the following elementsa. an integer variable named

  Display student details and classes in applet

Display student details and classes they have enrolled in Applet. The Applet should have following features. Update and View.

  Credit card expenses

You started recording every credit card transaction so that you can analyze your monthly expenses. You used an Excel worksheet to track dates, places, categories, and amounts. Because you are a consultant who travels periodically, you also have bu..

  Write program in java for total amount of customer-s order

Write down program in Java which would ask for clerk to enter total amount of customer's order. Program will then compute seven percent (7%) sales tax.

  Program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50.

  Processing file data in java

Purpose: This assignment will provide more practice in processing file data in Java.  It will also require the declaration of a class type, the creation of a list of objects, and some simple processing of the list that will involve sorting and com..

  Variable is named res and is used to input a resistanc

Assume the existence of the following Java GUI application. There are two text fields for user input. The first JTextField variable is named res and is used to input a resistance value in ohms. The second JTextField variable named cap is used to..

  Write a java loop

write a java loop ( of your choice ) that produces exactly the following output to the screen: 2-4-6-8-

  Your program should ask the user to input a grade

Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade.

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