Assigned on Friday, 10/1.
Due by 5 PM on Wednesday, 10/6.
For this portion of the Minibrowse project, you will add Back and Forward buttons to your browser that work similarly to those in a real web browser. You can start with your Minibrowse code from the previous assignment, or you can start from scratch with the core Minibrowse code if you like. (This assignment doesn't depend on the success of the previous one).
If you haven't started working in a separate directory (folder) for each assignment by now, it is crucial that you start doing so. Make sure that you create a new empty directory to hold the code for this new assignment, then copy in the files that you need. If you have questions on how to do so, stop into CMC 306 and ask one of the friendly lab assistants for help. When you hsp your assignment, you should submit the entire folder. This way your code doesn't collide with your previous submissions.
Start with your own Minibrowse code (preferably), or alternatively start with a copy of your previous Minibrowse submission (link on History assignment).
Create a generic class called Stack127<E> that implements the
interface StackInt
Modify Minibrowse so that whenever a user enters a web page, its URL is pushed onto a stack associated with the Back button. Whenever a user clicks on the Back button, the current URL should be pushed onto a stack associated with the Forward button before a URL is popped off the Back button stack and displayed. Likewise, whenever a user clicks the Forward button, the same thing should happen in reverse. Make sure to handle the special case that if a user types in a URL into the address bar, the Forward button should be cleared (play around with a "real" browser and see how the Forward button behaves when you typed in a new web page).
The only mechanism you can use to store web pages is via pushing onto a stack. Don't "violate" the stack by inserting things into the middle. Specifically:
You can only view what web page is on the top of a stack by using a peek() or pop() function. Don't "violate" the stack by looking at what items are below the top.
In order to clear a stack (such as when you need to clear out the Forward button), you must do so by popping everything off the stack until it is empty.
Have fun!