Question: Java Eclipse Programming Project 3.1 on page 64 (100 points). Include one or more Exception classes in the project so that you can throw an

Java Eclipse
Java Eclipse Programming Project 3.1 on page 64 (100 points). 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. Use the
Player class from PP 1 and write another class that is meaningful
to you. In the driver, you will create objects of these classes,
and manipulate them using two slacks, with one for cach class. You

Programming Project 3.1 on page 64 (100 points). 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. Use the Player class from PP 1 and write another class that is meaningful to you. In the driver, you will create objects of these classes, and manipulate them using two slacks, with one for cach class. You have to make sure you tost 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 Slack data structure, meaningfully. In the Driver, you must test all methods in a self-documentary way. When the oulput is displayed, it should be self-explanatory. The reader should not have to look at your code to understand the output. PP 3.1 Complete the implementation of the ArrayStack class presented in this chapter. Specifically, complete the implementations of the isEmpty, size, and toString methods. In the Java Collections API framework, class names indicate both the underlying data structure and the collection. We follow that naming convention in this text. Thus, we define a class called ArrayStack to represent a stack with an underlying array-based implementation. To be more precise, we define a class called ArrayStack that represents an array-based implementation of a stack collection that stores objects of generic type T. When we instantiate an ArrayStack object, we specify what the generic type T represents. An array implementation of a stack can be designed by making the following four assumptions: The array is an array of object references (type determined when the stack is instantiated), the bottom of the stack is always at index 0 of the array, the elements of the stack are stored in order and contiguously in the array, and there is an integer variable top that stores the index of the array immediately following the top element in the stack. Key Concept For efficiency, an array-based stack implementation keeps the bottom of the stack at index 0 Console *TE kterminated, Stackbilver (1) Dave Application Program de 1.80.1011 big1661 stack OE players Naler Rex cover 29 Ranks Level 3 Natet Christy Score: 13 Rankt Level 4 Name: Zane Score: 31 Ranki Level 2 Nome: Cali Scoret 39 Rank: Level 2 Current number of players in the stock: 1 Current player on top of stack Nome: Cali Score: 99 Rank: Level 2 Altered stack of players! Name: Rex Score: 29 Bank: Level 3 Name: Christy Scorer 13 Ranki Leval Current number of players in the stack 2 Current player on top of acak! Name: Christy Score: 13 Rank: Level 4 Stack empty true or tale): false Current number of players in the stack: 0 Stack empty (Grue or false): true Original stack of cats: M. VEE Console X 13 XBIE terminated > StackDriver (1) Ilava Application Program FilesVavaljte 1.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: Fuxball Breed: Linx Age: 5 Cats in stack speaking: Yuxball Speak: Meowt Fluffy Speak: Heos! Ritty Spcak: Meow! Altered stack of cats: Name: Kitty Breed: Tabby Age: 3 Current number of cats in the atack: 1 Current cat on top of stack! Home Kitty Broed: Tabby Age: 3 Stack espty true or talne) i talse Current number of cats in the stack: o Stack empty (crue or folosi true Nr. 23123 Creating first stock, to track players. Peaking at top of stacka. exceptions. EmptyStackexception: Stack is empty. No elenent to return Looks enpty. Let's double check, Just in case... true Yap, empty. Let's add some Players to it. Creating five Players. Pushing the five players on the stack. Creating generic Players pl, P2, P3 Popping the top three players on Stack 1 inta pa, p2, and p). 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 stock. Susan 168 Level 2 How many players are in the stack, again? 5 Printing out stack of Players Susan 108 Level 2 Clara 233 Level 3 Dary) 158 Level 2 Shawn Unranked Agron Unranked Creating a second stack, to track Characters Peeking at tap of stack 2 exceptions. EmptySteckexceptioni Stuck is empty. No element to return Looks empty. Let's double check, just in case true Yep, enpty. Let's add some Characters to it. Creating ) Characters. Pushing the three characters on the stack Creating a second stack, to track Characters. Peaking at top of stack2 exceptions. Empty Stackexception Stack is empty. No element to return Looks empty. Let's double check, just in case... trus Yep, empty. Let's add some Characters to it. Creating 9 Characters. Pushing the three characters on the stack. Printing out the stack real fast. Butano: 0. Elf: Damon Hunter: 110 844 Gaay: N. Elf: Warrior : 180 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... Gasv: N. tlf: Warrior: 1ee 712 Ok, reprinting the stack one more time, to make sure. Gaav: N. Elf: Warrior 712 Butane: 8. Elf: Demon Hunter 11e 844 Dracon: Human: Paladin: 110 897 100 I forget, how many players were in stackar 5 Purpose: Incorporate Exception classes so that the program is robust and graceful Define an interface for the Stack data structure so that classes can implement the interface Implement the Stack interface by defining the Stack dota structure class with an array Continue to review classes and object by defining your own classes (two of them) to represent two different kinds of objects Create Stack objects to organize other objects so as to easily manipulate them accessing/modifying/updating/deleting) Fully test a defined class by invoking each method of a class Employ the packaging structure to organize your classes Employ the javadoc tool to write and generate documentation/API

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!