Someone Please Help Assignment Java Data Structures Algorithms Real Hard Time Getting Star Q43897589
Will someone please help me with this Assignment for Java (DataStructures and Algorithms) I am having a real hard time gettingstarted. The assignment is posted below. Thanks.
Pile of Book
Imagine a pile of books on your desk. Each book is so large andheavy that you can remove only the top one from the pile. Youcannot remove a book from under another one. Likewise, you cannotadd a book beneath another one. You can add another book to thepile only by placing it on the top of the pile.
If you represent books by their titles alone, design a classthat you can use to track the books in the pile on your desk.Specify each operation by stating its purpose, by describing itsparameters, and by writing a pseudocode version of its header. Thenwrite a Java interface for the pile’s methods. Includejavadoc-style comments in your code.
Define a class PileOfBooks that implements thisinterface. Use a resizable array in yourimplementation. Then write a program that adequately demonstratesyour implementation.
In this program, you will need to have 1 class with the name asPileOfBooks, 1 interface with the name asPileInterface, and 1 test class to testeverything.
The followings are how books are added the 1st timein your test class:
myPile.add(“And Then There Were None”);
myPile.add(“The Hobbit”);
myPile.add(“The Lord of the Rings”);
myPile.add(“The Da Vinci Code”);
myPile.add(“The Catcher in the Rye”);
Then you will need to add another pile of books later.
You will need to create the following methods: add, remove,getTopBook, isEmpty, clear.
The add method should add a new book to the topof this pile.
The remove method should remove and return thispile’s top book.
The getTopBook method should retrieve thispile’s top book.
The isEmpty method should detect whether thispile is empty.
The clear method should remove all books fromthis pile.
Make sure to make the Implementation Secure. You will need tocreate the following private methods: checkintegrity,checkCapacity, doubleCapacity, isArrayFull.
Please make the DEFAULT_CAPACITY = 4;
MAX_CAPACITY = 10000;
Throws an exception if the client requests a capacity that istoo large. (IllegalStateException).
Throws an exception if receiving object is not initialized.(SecurityException)
(Please produce the result as the sample run.)
Here is a sample run:
Create an empty pile of books:
isEmpty() returns true
Add to pile.
isEmpty() returns false
Testing peek and pop:
The Catcher in the Rye is at the top of the pile.
The Catcher in the Rye is removed from the pile.
The Da Vinci Code is at the top of the pile.
The Da Vinci Code is removed from the pile.
The Lord of the Rings is at the top of the pile.
The Lord of the Rings is removed from the pile.
The Hobbit is at the top of the pile.
The Hobbit is removed from the pile.
And Then There Were None is at the top of the pile.
And Then There Were None is removed from the pile.
The pile should be empty:
isEmpty() returns true
Add to the pile.
Testing clear:
The pile should be empty: isEmpty() returns true
myPile.getTopBook() returns null
myPile.remove() returns null
Done.
PreviousNext
Expert Answer
Answer to Will someone please help me with this Assignment for Java (Data Structures and Algorithms) I am having a real hard time …
OR