Question: Program Due: Monday, April 2 2 nd , before 9 : 0 0 a . m . Name the project Prog 1 1 YourLastName Name

Program Due: Monday, April 22nd, before 9:00 a.m.
Name the project Prog11YourLastName
Name the main class BattleDemoYourLastName.java
Name the Pokemon class PokemonCardYourLastName.java
Name the Node class NodeYourLastName (if you have one)
Name the Stack class StackYourLastName.java
Be sure to read these specifications CAREFULLY so that your program works EXACTLY as expected
on a given set of data, because that's how it will be tested.
This programming assignment requires the use of the Stack class. You may choose either the array or
the linked-list implementation.
The Stack will contain PokemonCard objects. (Technically, its PokemonCardYourLastName and
StackYourLastName, but Im going to leave off YourLastName for clarity in the description.) A
PokemonCard object contains three instance variables: the name of the Pokemon (a String), the
multiplier of that Pokemon (integer) and the Pokemons power (double). From now on, Ill just call this
a Card.
The Pokemon Battle
Take a deck of up to 52 cards and deal them to 2 players. To deal means to give player1 the first card,
player2 the next, player1 the next, and so on until there are no more cards in the deck.
Each player will maintain two stacks of cards: a play stack and a discard stack. Initially all cards dealt to
each player are pushed onto that players play stack, while their discard stack is initially empty.
Proceed as follows until someone runs out of cards or the game takes too long:
(1) Each player pops the top card from their play stack. If a player's play stack is empty, but their discard
stack is not, copy the contents of the discard stack into the player's play stack but do so in a way that
preserves the same bottom-to-top order of the cards. The result of the copy from discard into play is that
the play stack now contains exactly what the discard stack once did and the discard stack is empty.
(2) Compare each cards power. If the two powers ARE NOT EQUAL, then the player with the card of
higher power wins and they place (push) both cards onto their discard stack in the following order:
higher power card first, then lower power card.
(3) Else if the two powers are EQUAL, then a "battle" occurs: To settle the battle, compare the
multipliers of each card to see who wins. If the multipliers are the same, each player pushes their card
onto their own discard stack.
We will assume that a game "takes too long" if it takes 1000 plays and theres still no winner.
Ending the Game
If only one player has cards remaining, then that player is the winner. Otherwise, if the play limit is
reached, then the player with the most cards is declared the winner. If both players ended up with the
same number of cards, then the game ends in a tie.
2
Output
The program should play the game to its conclusion and then print out the following:
The game started with __ cards.
There were __ plays in the game.
The game ended with a clear winner. or The game took too long.
Player 1 ended up with ___ cards.
Player 2 ended up with ___ cards.
The winner was __.(Player1 or Player2 or No one)
Your program will begin by prompting the user to enter the name of an input file that contains a preshuffled deck of Pokemon cards. Write a method that reads in a pre-shuffled deck of cards from an input
file. The input file is formatted as our previous files have been: an integer representing the number of
cards, then a set of String/integer/double triples. Assume that each value appears on a line by itself. You
may assume that the input file will contain at most 52 cards and will be p
Program Due: Monday, April 2 2 nd , before 9 : 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!