Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solitaire Prime-Prog1 CECS 282-os-Spring 2018 Due: Feb 13, 2018 Solitaire is a card game that is played by one person. Solitaire is also known by

image text in transcribed
image text in transcribed
Solitaire Prime-Prog1 CECS 282-os-Spring 2018 Due: Feb 13, 2018 Solitaire is a card game that is played by one person. Solitaire is also known by the name "Patience" It is estimated that there are more than 1700 different versions of Solitaire... make that 1701 because we are inventing a new Solitaire game today Welcome to Solitaire Prime! This game uses one standard deck of cards. Here are the rules: 1) Take the top card from the deck and place it face up on the table. 2) The Sunn is now the value of that card (Ace = 1, 2-2, 10-10, Jack-10, Queen-10, King = 10) If the sum is a prime number, discard that pile (hand), and start over at instruction #1 3) 4) If the Sum is not prime, take the next card from the top of the deck and place it on top of the card stack (pile or hand) on the table. 5) The Sum is now the sum of all cards in the stack on the table. Go to instruction #3. 6) Continue to play the game, keeping track of how many "hands" you have created that are prime. If the last card from the deck gives you a prime hand, then you win! Write the word "Winner" on the screen and show how many prime hands there were. If the last card from the deck does not give you a prime hand, then you lose. Write the word "Loser" in the screen. These 2 screen shots show possible winner and loser hands if I were using just 13 cards (I am using a mini-deck that only has Spades) Notice that each time a card is dealt, the card is displayed and the current sum of the hand is displayed as well. When you acquire a Prime Hand, print out the value (prime number) and start over on the next line. studi.. 3S C29. Prine :29 3 clusersistevengldocuments lvisual studi 105 10) 185 C20.4824.8C31).Prine :31 6.18S 16.18S C26 S,Prine :5 S c8.18s .9S (31). Prine:31 S(5). Prine:5 S(?,Prine:? 10S10.Loser 9S(9.188 (19 Prine :19 inner in 5 handst You will have 2 classes: 1) The Deck class which will create the deck of cards 2) The Card class which creates cards

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions