Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Browser History Web browsers commonly allow you to navigate through a history of web pages which have previously been visited. The mechanism is somewhat

image text in transcribedimage text in transcribed

JAVA

Browser History Web browsers commonly allow you to navigate through a "history" of web pages which have previously been visited. The mechanism is somewhat like a stack, in that the most recently visited pages are at the top of the history and revisited when the "back" button is pressed. However, the history does not really have infinite capacity. In reality, there may exist a fixed limit on the size of the history. The issue arises as to what should happen when the capacity is exhausted and a new item is pushed onto the stack. You will use the BoundedStack class for the browser history that only has room to save 50 pages in its history. When the client visits more pages, it will make room in the history for a new page by throwing away the page which is on the very bottom of the history (i.e., the least recently visited page). When the client wishes to go back to the last visited page, that page will be popped from the top of the history Maji Game You will also need the BoundedStack class to assist with a larger game that includes characters who battle using magical spells. Because each of the spells has a potency value, the spell with the highest potency wins the battle. Throughout the game, players stack their spells to be used later in a speed battle round up to a maximum of 50 spells. During the game, if a player adds a spell when the stack is full, the spell is added to the top of the BoundedStack and the least recently added spell is removed from the bottom. In the speed battle, the last spell to be added to the stack is played first. You will use the BoundedStack class to load one player's spell potency values into the stack, then display the stack in reverse order to simulate the order each spell potency will be used in the speed round. Requirements for the main class Browser History Create an object of the BoundedStack class for a browser back button. This will be a String BoundedStack object. Call the push method and pass a string: either a web page url or ip address. Repeat the method call in a loop 51 times to test the overflow. Call the pop method until the BoundedStack is empty and display the return value each time. This should display 50 web page urls or ip addresses. Maji Game Create an object of the BoundedStack class for a stack of Doubles for the magi spell potency values. This will be a Double BoundedStack object. Call the push method and pass a Double magic spell value. Repeat the method call in a loop 51 times to test the overflow. Call the pop method until the BoundedStack is empty and display the return value each time. This should display 50 spell potency values. Browser History Web browsers commonly allow you to navigate through a "history" of web pages which have previously been visited. The mechanism is somewhat like a stack, in that the most recently visited pages are at the top of the history and revisited when the "back" button is pressed. However, the history does not really have infinite capacity. In reality, there may exist a fixed limit on the size of the history. The issue arises as to what should happen when the capacity is exhausted and a new item is pushed onto the stack. You will use the BoundedStack class for the browser history that only has room to save 50 pages in its history. When the client visits more pages, it will make room in the history for a new page by throwing away the page which is on the very bottom of the history (i.e., the least recently visited page). When the client wishes to go back to the last visited page, that page will be popped from the top of the history Maji Game You will also need the BoundedStack class to assist with a larger game that includes characters who battle using magical spells. Because each of the spells has a potency value, the spell with the highest potency wins the battle. Throughout the game, players stack their spells to be used later in a speed battle round up to a maximum of 50 spells. During the game, if a player adds a spell when the stack is full, the spell is added to the top of the BoundedStack and the least recently added spell is removed from the bottom. In the speed battle, the last spell to be added to the stack is played first. You will use the BoundedStack class to load one player's spell potency values into the stack, then display the stack in reverse order to simulate the order each spell potency will be used in the speed round. Requirements for the main class Browser History Create an object of the BoundedStack class for a browser back button. This will be a String BoundedStack object. Call the push method and pass a string: either a web page url or ip address. Repeat the method call in a loop 51 times to test the overflow. Call the pop method until the BoundedStack is empty and display the return value each time. This should display 50 web page urls or ip addresses. Maji Game Create an object of the BoundedStack class for a stack of Doubles for the magi spell potency values. This will be a Double BoundedStack object. Call the push method and pass a Double magic spell value. Repeat the method call in a loop 51 times to test the overflow. Call the pop method until the BoundedStack is empty and display the return value each time. This should display 50 spell potency values

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_2

Step: 3

blur-text-image_3

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

Students also viewed these Databases questions

Question

What happens during a 2-for-1 stock split?

Answered: 1 week ago