Question
Maji Game You will also need the BoundedStack class to assist with a larger game that includes characters who battle using magical spells. Because each
Maji Game
You will also need the BoundedStack class to assist with a larger game that includes characters who battle using magical spells. Because each of the spells has a potency value, the spell with the highest potency wins the battle. Throughout the game, players stack their spells to be used later in a speed battle round up to a maximum of 50 spells. During the game, if a player adds a spell when the stack is full, the spell is added to the top of the BoundedStack and the least recently added spell is removed from the bottom.
In the speed battle, the last spell to be added to the stack is played first. You will use the BoundedStack class to load one player's spell potency values into the stack, then display the stack in reverse order to simulate the order each spell potency will be used in the speed round.
Requirements for the main class:
Maji Game Create an object of the BoundedStack class for a stack of Doubles for the magi spell potency values.
This will be a Double BoundedStack object.
Call the push method and pass a Double magic spell value.
Repeat the method call in a loop 51 times to test the overflow.
Call the pop method until the BoundedStack is empty and display the return value each time.
This should display 50 spell potency values.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started