Question: Programming Project 3.1 on page 64 from Java Software Structures: Designing and Using Data Structures 4th edition. Complete the implementation of the ArrayStack class presented

Programming Project 3.1 on page 64 from Java Software Structures: Designing and Using Data Structures 4th edition. "Complete the implementation of the ArrayStack class presented in this chapter. Specifically, complete the implementations of the isEmpty, size, and toString methods."

Include one or more Exception classes in the project so that you can throw an exception if an object is null or there is an error.

For this problem, you will have to write TWO classes. One using the Player class and another class that is meaningful to you.

In the driver, you will create objects of these classes, and manipulate them using two stacks, with one for each class.

You have to make sure you test all methods in the Stack class meaningfully.

You also have to make sure you test all methods in the two classes you have written while manipulating the objects using the Stack data structure, meaningfully.

In the Driver, you must test all methods in a self-documentary way. When the output is displayed, it should be self-explanatory. The reader should not have to look at your code to understand the output.

Programming Language is Java. Can you help me figure out this one? I would very appreciate it. Please and thank you!

Edit: I actually don't know the existing code for this. I'm just having a hard time figuring this out on my own, as the screenshots below are sample outputs that I'm having trouble understanding. If I need to resubmit this question again, then let me know.

Programming Project 3.1 on page 64 from Java Software Structures: Designing and

Using Data Structures 4th edition. "Complete the implementation of the ArrayStack class

presented in this chapter. Specifically, complete the implementations of the isEmpty, size,

Console X StackDriver (1) [Java Application] C:\Program Files\Java\jre1.8.0_101\bir riginal stack of players: Name: Rex Score: 29 Rank: Level 3 Name: Christy Score: 13 Rank: Level 4 Name: Zane Score: 31 Rank: Level 2 Name: Cali Score: 39 Rank: Level 2 Current number of players in the stack: 4 Current player on top of stack: Name: Cali Score: 39 Rank: Level 2 Altered stack of players: Name: Rex Score: 29 Rank: Level 3 Name: Christy Score: 13 Rank: Level 4 Current number of players in the stack: 2 Current player on top of stack: Name: Christy Score: 13 Rank: Level 4 Stack empty (true or false): false Current number of players in the stack: 0 Stack empty (true or false): true Original stack of cats: Name. + B Console X StackDriver (1) [Java Application) C:\Program Files Java\jre1.8.0. Original stack of cats: Name : Kitty Breed: Tabby Age: 3 Name: Fluffy Breed: Persian Age: 1 Name: Furball Breed: Linx Age: 5 Current number of cats in the stack: 3 Current cat on top of stack: Name: Furball Breed: Linx Age: 5 Cats in stack speaking: Furball Speak: Meow! Fluffy Speak: Meow! Kitty Speak: Meow ! Altered stack of cats: Name: Kitty Breed: Tabby Age: 3 Current number of cats in the stack: 1 Current cat on top of stack: Name: Kitty Breed: Tabby Age: 3 Stack empty (true or false): false Current number of cats in the stack: 0 Stack empty (true or false): true terminated TestingDriver (Java Application) C:\Program Files Javaljre 1.8.0_101\bin\javaw.exe (Feb 15, 2017, 10:53:06 PM) Creating first stack, to track Players. Peeking at top of stacki. exceptions. EmptyStackException: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Players to it. Creating five Players. Pushing the five players on the stack. Creating generic Players p1, P2, P3. Popping the top three Players on Stack 1 into pi, p2, and p3. Arranging them in an array for easy looping. Using the play method on the player array via a loop, and then pushing them back to the stack. Taking a peek at the top of the stack. Susan 168 Level 2 How many players are in the stack, again? 5 5 Printing out stack of players. Susan 168 Level 2 Clara 233 Level 3 Daryl 158 Level 2 Shawn Unranked Aaron Unranked Creating a second stack, to track Characters. Peeking at top of stack2. exceptions. EmptyStackException: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Characters to it. Creating 3 Characters. Pushing the three characters on the stack. Creating a second stack, to track Characters. Peeking at top of stack2. exceptions. EmptyStackexception: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Characters to it. Creating 3 Characters. Pushing the three characters on the stack. Printing out the stack real fast. Butan: B. Elf: Demon Hunter: 110 844 Gaav : N. Elf: Warrior: 100 712 Dracon: Human: Paladin: 110 897 Let's see if they can all run Heroics. true false true Gaav can't? Ok. Let's put him back last. Let's make sure we did that right... Gaav: N. Elf: Warrior: 100 712 Ok, reprinting the stack one more time, to make sure. Gaav: N. Elf: Warrior: 1ee 712 Butane: B. Elf: Demon Hunter: 110 844 Dracon: Human: Paladin: 110 897 I forget, how many Players were in stack1? 5 Console X StackDriver (1) [Java Application] C:\Program Files\Java\jre1.8.0_101\bir riginal stack of players: Name: Rex Score: 29 Rank: Level 3 Name: Christy Score: 13 Rank: Level 4 Name: Zane Score: 31 Rank: Level 2 Name: Cali Score: 39 Rank: Level 2 Current number of players in the stack: 4 Current player on top of stack: Name: Cali Score: 39 Rank: Level 2 Altered stack of players: Name: Rex Score: 29 Rank: Level 3 Name: Christy Score: 13 Rank: Level 4 Current number of players in the stack: 2 Current player on top of stack: Name: Christy Score: 13 Rank: Level 4 Stack empty (true or false): false Current number of players in the stack: 0 Stack empty (true or false): true Original stack of cats: Name. + B Console X StackDriver (1) [Java Application) C:\Program Files Java\jre1.8.0. Original stack of cats: Name : Kitty Breed: Tabby Age: 3 Name: Fluffy Breed: Persian Age: 1 Name: Furball Breed: Linx Age: 5 Current number of cats in the stack: 3 Current cat on top of stack: Name: Furball Breed: Linx Age: 5 Cats in stack speaking: Furball Speak: Meow! Fluffy Speak: Meow! Kitty Speak: Meow ! Altered stack of cats: Name: Kitty Breed: Tabby Age: 3 Current number of cats in the stack: 1 Current cat on top of stack: Name: Kitty Breed: Tabby Age: 3 Stack empty (true or false): false Current number of cats in the stack: 0 Stack empty (true or false): true terminated TestingDriver (Java Application) C:\Program Files Javaljre 1.8.0_101\bin\javaw.exe (Feb 15, 2017, 10:53:06 PM) Creating first stack, to track Players. Peeking at top of stacki. exceptions. EmptyStackException: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Players to it. Creating five Players. Pushing the five players on the stack. Creating generic Players p1, P2, P3. Popping the top three Players on Stack 1 into pi, p2, and p3. Arranging them in an array for easy looping. Using the play method on the player array via a loop, and then pushing them back to the stack. Taking a peek at the top of the stack. Susan 168 Level 2 How many players are in the stack, again? 5 5 Printing out stack of players. Susan 168 Level 2 Clara 233 Level 3 Daryl 158 Level 2 Shawn Unranked Aaron Unranked Creating a second stack, to track Characters. Peeking at top of stack2. exceptions. EmptyStackException: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Characters to it. Creating 3 Characters. Pushing the three characters on the stack. Creating a second stack, to track Characters. Peeking at top of stack2. exceptions. EmptyStackexception: Stack is empty. No element to return Looks empty. Let's double check, just in case... true Yep, empty. Let's add some Characters to it. Creating 3 Characters. Pushing the three characters on the stack. Printing out the stack real fast. Butan: B. Elf: Demon Hunter: 110 844 Gaav : N. Elf: Warrior: 100 712 Dracon: Human: Paladin: 110 897 Let's see if they can all run Heroics. true false true Gaav can't? Ok. Let's put him back last. Let's make sure we did that right... Gaav: N. Elf: Warrior: 100 712 Ok, reprinting the stack one more time, to make sure. Gaav: N. Elf: Warrior: 1ee 712 Butane: B. Elf: Demon Hunter: 110 844 Dracon: Human: Paladin: 110 897 I forget, how many Players were in stack1? 5

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 Databases Questions!