Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[JAVA]: Hello! I've been having some trouble with this program -- specifically with the CardDeck method. Everything needs to be in one Class. Thanks! 20.6

[JAVA]:

Hello!

I've been having some trouble with this program -- specifically with the CardDeck method.

Everything needs to be in one Class.

Thanks!

image text in transcribed

20.6 Program 2b: Card Deck Objectives 1. Practice with classes and objects 2. Code a class of a deck of playing cards Background Reading and Resources . ZyBooks Chapter 7 Objects and Classes Make sure you have an IDE that you can use Program to turn in Rolling with the same theme, we are going to focus on the characteristics and functionality of a deck of cards. In this program you will be creating a CardDeck java file in your IDEs that will have the following characteristics Class Variables: public String[] ranks= {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace" public String[] suits"Clubs" "Diamonds", "Hearts", "Spades") public String[] deck // initialize to size of 52 for the number of cards there are in a standard deck (NO JOKERS) These arrays will be important, and for that reason I want you to put the ranks. and 'suits' array in your code EXACTLY as you see it above When we populate our deck we are going to store each card exactly as we say them, for example "Ace of Spades or 3 of Clubs" Class Methods class CardDeck -public String getIdentificationstring ) -public CardDeck () -public String getCard (int index) -public String getFirst -public String getLast () -public String randomCard () -public String royalFlush () public String getldentificationString0. this will be found in almost all of your programs for the year this just returns a string with the program number and letter, your first and last name, and your cssc number. For example: Program 2b, Firstname Lastname public CardDeck0, this will be your constructor for your class and will be where you fill your "deck array. This one is going to be a bit tricky to populate but I know you guys can do it. I'm going to give you some hints to get started. For starters use a for-loop within a for-loop, one for the ranks and one for the suits. Initialize the index tracker of the 'deck array OUTSIDE of these for loops. Remember to store each card in "deck" as you say it: "rank of suit. I know this is going to be tricky but come by office hours of either the TAs or Professor Kraft we are going to be here to help you all. public String getCard(int index), return the card at the given index. public String getFirst0, return the first card in 'deck public String getLast0, return the last card in "deck public String royalFlush0, return a String of cards that are contained in a Royal Flush poker hand. If you don't know what a Royal Flush consists of, you can give it a quick google search and you'll be able to figure it out. But the way I would like you to return it is all the cards on one line with a comma then a space in between each card

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

6. How will you provide encouragement and support?

Answered: 1 week ago

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago

Question

6. What data will she need?

Answered: 1 week ago