Java Oriented Program I need a program that simulates playing clock solitaire. T
ID: 3829671 • Letter: J
Question
Java Oriented Program I need a program that simulates playing clock solitaire. This is how the game is played https://youtu.be/6AEJEf8L95g https://youtu.be/yUj320C9210
First required class is Card class that represents each of the 52 playing cards: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King … in each of the four suits: Spades, Hearts, Diamonds, and Clubs.
Implement the following methods: constructors getSuit() getValue() String toString(): to print cards ex: "10H" or "QC"
Also, create a deck class that represents a standard deck of 52 playing cards.
Implement the following methods: constructors, void shuffle(): randomly interchanges cards in the deck to simulate shuffling, Card dealCard(), int cardsLeft(), String toString(): iterate through your deck array, printing all the cards, in a way that’s convenient to check what cards are there.
Create a pile class that contains no more than 5 cards. Some cards are to be face up and some are to be faced down.
Implement the following methods:constructors, void addCardFaceDown( Card card), Card removeCard() - removes and returns the “top” face down card (null if there are none) and int getNumberOfFaceDown(), void addCardFaceUp( Card card), int getNumberOfFaceUp(), String toString() - print the cards in the Pile; print the contents of a pile on one or two lines; label the portion of the pile that’s face up versus face down .
Playing the Game
1.remove (top, face-down) card from Pile 13, the Kings Pile
2.add it, face-up, to the (“bottom” of the) correct Pile
a.also, keep track of and print the “step number,” a counter that you increment each time you “remove-and-add” a card
4.remove (top, face-down) card from that same Pile
a.one needs to check that there are face-down cards remaining
b.if there are no face-down cards remaining, the game is over, if you’re on Pile 13
c.(if there are no face-down cards remaining, and you’re not on Pile 13, then there’s an error)
5.repeat this process by going to step 2
When Each Game is Done
print the thirteen Piles -- the game board (as above), if the print level is not “silent”
print the “score”: the number of Piles with at least one face-down card, if the print level is not “silent”
a score of “zero” is a “win”; note this is rare
increment a counter in a Scores array for the number of Piles with at least one face-down card
repeat, from the top (the Setup), according to how many games to play, as specified in the command-line arguments
When You’ve Completed Playing the Required Number of Games
print the number of games played
print the Scores array, along with percentages, as follows; this will be 14 lines, with both the number and percentage of games that resulted in each score
Explanation / Answer
Code:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.