Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

n this assessment, write a simple card game similar to the classic card game war. Each card will be represented using an integer stored inside

n this assessment, write a simple card game similar to the classic card game "war." Each card will be represented using an integer stored inside an array. Two players will receive five cards each, and then the players will compete for five rounds to see who has the higher card during each turn.
For example, if player one has cards 5,10,3,15,2 and player two has cards 1,8,17,0,4, the game would be played as follows:
Round 1:
Player 1: 5, Player 2: 1, Player 1 wins!
Round 2:
Player 1: 10, Player 2: 8, Player 1 wins!
and so on...
At the end of the game, the player who won the most rounds is the winner.
Notes:
You can hardcode the values for the cards for each player. You do not have to write any logic for randomizing the cards or dealing cards. However, for an extra 5 points, you can add this functionality.
For example: a player's cards can be stored in an array such as: int[] player1={5,10,3,15,2};
For another extra 5 points, make the game more flexible, so that each player can have 1 to 26 cards (the game should prompt the user for the number of cards per player at the beginning of the program).
Do NOT use the ArrayList class for this assignment.

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

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions

Question

How and when will I measure my success? more likely to be off base?

Answered: 1 week ago