Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming Assignment 6 The Web Browser Web browsers are deceptively complex programs. The simple task of opening a web page carries a lot of

Java Programming Assignment 6 The Web Browser

Web browsers are deceptively complex programs. The simple task of opening a web page carries a lot of steps: networking calls, protocol exchanges, rendering graphics, download and storage, JavaScript functionality, etc. Its a lot to handle. The myriad number of tasks at hand provides a great example of different situations for collecting and managing information. Perfect for trying out the Java Collections Classes.

Program requirements:

Create a new class, called WebBrowser. Inside it, place your main program. When run, your program will ask the user for commands.

The following commands should be provided:

o GOTO

o DOWNLOAD

o BACK

o FORWARD

o SHOW_DOWNLOADS

o CLEAR_DOWNLOADS

o SHOW_HISTORY

o CLEAR_HISTORY

o END

For the command above, should be any user-input String in the format of a typical web address.

Inside your WebBrowser main program, create the following:

o A Stack of Strings called backwards

o A Stack of Strings called forwards

o A Queue of Strings called downloads

o A List of Strings called history

o A String called currentURL

The command GOTO should place the users entered into the currentURL. It should also add it to the history list. If currentURL was not empty, the previous URL should be added to the backwards Stack. Print out the currentURL

When the user types BACK, remove the top of the Stack backwards and place it in currentURL. Put the previous URL into the forwards Stack. If the backwards Stack is empty, alert the user that nothing happened. Print out the currentURL

When the user types FORWARD, remove the top of the Stack forwards and place it in currentURL. Put the previous URL into the backwards Stack. If the forwards Stack is empty, alert the user that nothing happened. Print out the currentURL

If a user types GOTO at any point, clear the forwards Stack. (Logically, once a user goes to a new site, the trail forward is lost.)

If a user types DOWNLOAD, add the currentURL to downloads

If a user types SHOW_DOWNLOADS, print the contents of downloads

If a user types CLEAR_DOWNLOADS, empty the contents of downloads

If a user types SHOW_HISTORY, print the contents of history

If a user types CLEAR_HISTORY, empty the contents of history

If a user types END, exit the program

Include appropriate comments throughout your code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

How do we organise for international logistics?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago