Question

# lab 2 information        . Submission: CardGame. java...

lab 2 information

Image transcription text

Scenario: You are a magician and you are practicing your card tricks. Since you don't want to reveal your secrets, you write a program that will pick a random card from the deck so you can practice your tricks alone. Use a random number generator to select a number from 0 to 51 (inclusive). Each number represents one card, and the suits are grouped: Cards 0-12 represent the diamonds, 13-25 represent the clubs, then hearts, then spades. In all suits, card identities ascend in step with the card number: 13 is the ace of clubs, 14 is the 2 of clubs, and 25 is the king of clubs. Follow the steps below to write your java program. 1. 2. \$3.0&quot; 9&quot;?" Write your java code in a program called Card. java Generate a random number cardNumber using Java Math class. Note that we do not need to import the Math class like we do with Scanner. (See note below (Recall) step 6, to see how to use the random class for this assignment) 1. Note that you will generate a random number between 0 and 51 Declare two String variables: a String corresponding to the name of the suit and a String corresponding to the identity of the card (String suitName , cardIdentity ;). String is the Java type for text. String variables may be assigned any text and the text should be included between double quotations (sui tName = "clubs&quot;; for example) Determine the suit name by using integer divide. (cardNumber / 13) 1. Cards 0-12 represent the diamond 2. 13-25 represent clubs, 3. 26-38 represents hearts 4. 39-51 represents spades Use if statements to assign the suit name. Add one to cardNumber, and use the modulus operation to determine the card identity as follows: ( (cardNumber+1) % 13) 1. O = King 2. 1 = Ace 3. 2 — 10 is the identity 4. 11 = Jack 5. 12 = Queen Use a switch statement to assign the card identity. Print out the name of the randomly selected card. Make sure your code is properly commented and you use good style (camelCase, proper indentation, etc).

...

Image transcription text

...

Solved by verified expert
<p>, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lo</p> Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet

Explore over 16 million step-by-step answers from our library

• `lisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, cons`
Step-by-step explanation
• onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit
• lestie consequat, ultrices ac magna. Fusce dui lect
• onec aliquet. Lorem ipsum dolor sit amet, consectetur a
• ipsum d
4 Attachments
jpg
jpg
jpg
jpg
Student review
100% (1 rating)
Thorough explanation

"You doing very good job, but it be a little late."