Question
Nine Cards. This is a simple game. The user enters an integer that is used as the seed to the Random object. Then 9 cards
Nine Cards. This is a simple game. The user enters an integer that is used as the seed to the Random object. Then 9 cards are dealt in a 3-by-3 arrangement.
If a row or column contains all the same suit, it prints FLUSH
If a row or column contains all the same rank (e.g all queens), it prints THREE OF A KIND
If a row or column contains all the same suit, it prints FLUSH
If a row or columns has a flush and another row or column has matching ranks, it prints GRAND PRIZE WINNER
If there are no flushes or matches, it prints YOU LOST.
1. Complete the portion of the main method that completes the 2D array of Cards and displays the cards.
2. Write the hasFlush method. Test this by temporarily calling it from the main method and seeing what it returns.
3. Write the hasThreeSame method. Test this by temporarily calling it from the main method and seeing what it returns.
4. Write the check method, call it from the main method, and print the returned string.
Remeber to comment your program.
Sample runs.
Seed: 15854 10 5 J Q 5 Q 2 5 4 GRAND PRIZE WINNER | Seed: 55 J K Q 6 8 J K 5 6 YOU LOST |
Seed: 59 10 A 7 K 7 10 9 4 J FLUSH | Seed: 230 10 6 8 7 5 A K K K THREE OF A KIND |
Java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started