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 nd before : am
Name the project ProgYourLastName
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 linkedlist 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 cards and deal them to players. To deal means to give player the first card,
player the next, player 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:
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 bottomtotop 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.
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.
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 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.
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 ended up with cards.
Player ended up with cards.
The winner was Player or Player 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 preshuffled 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 Stringintegerdouble triples. Assume that each value appears on a line by itself. You
may assume that the input file will contain at most cards and will be p
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
