CS 127 Assignments

Assignment 4: Minibrowse Back and Forward Buttons

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.

Part 1: Minibrowse

Start with your own Minibrowse code (preferably), or alternatively start with a copy of your previous Minibrowse submission (link on History assignment).

Part 2: Stack127

Create a generic class called Stack127<E> that implements the interface StackInt that we defined in class. You should implement your stack however you like, but you should not use the version that we developed in class. In other words, you should not use an array as the underlying structure for holding the data, but instead use an ArrayList, a LinkedList, or your own LinkedList127 class if you wish. You should not use the built in Stack class from the Java Collections Framework. This is so that you can gain the valuable experience of constructing a stack yourself. Once this assignment is complete and turned in, you will be free to use the standard Stack class on future homework assignments.

Part 3: Putting it together

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:

Have fun!