Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create this program in java Notes: Pseudocode is only needed for certain methods. These are explained in the skeleton code. You need minimum 3 methods.

Create this program in java

Notes: Pseudocode is only needed for certain methods. These are explained in the skeleton code. You need minimum 3 methods. You need to use loops for manipulating arrays. Do not use 50+ if statements to work on arrays. This will be counted against the Logic section in the rubric.

This post lab is broken up into 2 parts. Each will be its own method, and the choices will be collected from the main. Loop allowing the user to input part 1 or 2 as much as they want. If they enter -1, then end the program.

Part 1:

Based on what you learned in the lab, make a card game that asks the user to pick a number from a normal shuffled 52 card deck. Next, the computer picks a random number between 0 to 51. The program should then display whose card was highest.

Part 2:

As a second part to the program, create an auto play mode, where two computers play against each other. Like the first part, each computer randomly picks a card and a message declares the one with the highest card.

Have the deck shuffled every turn, and allow the two computers to play 100 times before quitting. Once they have played 100 times, display the winner of the whole game (who had the most wins out of 100 turns), or if it ended in a draw.

Have each part in its own separate method note that they should both be in a single class - and allow the user to choose between Part 1 or Part 2, for testing purposes. The main method should handle the input (getting the user choices) and call the methods.

Below is the input and the output we expect from your program. This is to help you know if you are on the right track. To test this Post Lab we might enter 6,8.7,34, 4.44, ect

Example input :

1

34

2

-1

Example output:

ID001

What part do you want to do? [integer]

Enter a card location from 0 to 51: [integer]

Computer chose: 2

You had a Queen of Spades!

Computer has a Ace of Diamonds

Computer had a higher card

What part do you want to do? [integer]

Computer 1 had a higher card: 2 of Diamonds

Computer 1 had a higher card: Queen of Spades

Tie

Computer 2 had a higher card: Queen of Clubs

[This goes on for 100 times]

Computer 1 had 53 wins

Computer 2 had 40 wins

Computer 1 won the game

What part do you want to do? [integer]

Goodbye!

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions