Question: Java Programming Introduction to Programming Introduction Throughout much of the semester we have been working with the cards program and have developed it in multiple

 Java Programming Introduction to Programming Introduction Throughout much of the semester

we have been working with the cards program and have developed it

in multiple forms. We shall continue this development process by refactoring the

Java Programming

Introduction to Programming Introduction Throughout much of the semester we have been working with the cards program and have developed it in multiple forms. We shall continue this development process by refactoring the last instance of the program so as to use multip write classes that model a Card, a Deck of Cards, and a Hand which holds Cards. Finally, you w You wi Write a main class Poker, that will create a Deck of Cards, shuffle the Deck, and then deal out Cards to multiple Hands For the development process, we shall work from the bottom up. Please read and follow the instructions below to write the specified four classes. Please submit the four Java source code files with the names 1. Card. java 2 Deck. java 3. Hand. java 4. Poker .java to the Blackboard Assignment, class Card [20] This class represents a single card. It maintains the card's card number. It can provide the card's suit and rank, and a human readable version of the card 1. (4] Define two symbolic constants as arrays of String elements named SUITS and RANKS. These arrays will be identical to the arrays we used in the previous version of the program. Based on thes arrays define additional symbolic constants names NSUITS, NRANKS, and NCARDS (the last being the product of the first two) 2. [3] There will be one instance field named cardNum of type int. Declare this field 3. [3]Define a single constructor that accepts a card number and assigns it to the instance field 4. [4] Define two accessor methods similar to the ones previously written in the older version of the program: a. int rank b. int suit 5. 4] Define the method String toString() that will return a String of the form rank of suit'' 6. [2] You may write a local main() method that you can use to unit test the correctness of this class class Deck 30 This class represents a deck of cards (we assume a normal card deck without any jokers). It maintains an array of cards and keeps track of where in the deck we are while cards are being dealt. It provides for constructing a new, ordered, deck of cards, shuffling the deck, and producing a String version of the deck for display purposes (most likely for debugging) 1. [4] Import classes that will be needed by this class a. java.util.Random b java. util .Arrays c java .util. NoSuchElementException mport the static fields from the Card class so that we do not need to prefix their names with the class name, Card (e.g., Card.NCARDS can be referred to by just NCARDS) a. import static exam3.Card 2. [3] Declare 3 instance fields a. Card[] deck the array to hold the cards in the dec b. int nextCardthe index in the deck which will be the next card to deal out C. Random rand a random number generator used by shuffle (this is an instance field since we only need one generator that may be invoked multiple times if we shuffle the deck multiple times) 3. [7] Define a no-argument constructor. a. [2] Instantiate the deck array with NCARDS elements. b 21 Set each element of the deck array with the Cardelement whose cardNum matches its index in the deck c [2] Set nextCard to 0 to indicate that we will start dealing from the top of the deck. d. [1] Instantiate a new random number generator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!