Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having a tough time figuring out virtual functions, nodes, and linked lists. The main.cpp will read the contents from a file into a linked

I'm having a tough time figuring out virtual functions, nodes, and linked lists. The main.cpp will read the contents from a file into a linked list with virtual functions. The node class and linked list classes must be in separate files. The input on each line would contain a command like navigate, back, forward, and print. Navigate would be followed by a string like "http:\\www.google.com" and would create a new node to store in the linked list. Back would show the previously stored node if not at the beginning of the list, and forward would show the next item in the list if not at the end of the list. Print would print all of the stored nodes, and indicate which one is the node currently being pointed at. An example of the files we are to use is given below, as well as an example of the outputs. This is a lot to ask but please help! Thanks

Input:

NAVIGATE http://google.com NAVIGATE http://reddit.com NAVIGATE http://facebook.com NAVIGATE http://myspace.com BACK BACK HISTORY NAVIGATE http://bing.com HISTORY
Output:  Oldest =========== http://google.com http://reddit.com <==current http://facebook.com http://myspace.com =========== Newest Oldest =========== http://google.com http://reddit.com http://bing.com <==current =========== Newest

Files we are to use:

#ifndef LIST_INTERFACE_H #define LIST_INTERFACE_H template class ListInterface { public: virtual ~ListInterface(){} virtual bool isEmpty() const = 0; virtual int getLength() const = 0; virtual void insert(int position, T entry) throw (std::runtime_error) = 0; virtual void remove(int position) throw (std::runtime_error) = 0; virtual void clear() = 0; virtual T getEntry(int position) const throw (std::runtime_error) = 0; virtual void replace(int position, T newEntry) throw (std::runtime_error) = 0; }; #endif
#include "ListInterface.h" #include class WebBrowserInterface { public: virtual ~WebBrowserInterface(){} virtual void navigateTo(std::string url) = 0; virtual void forward() = 0; virtual void back() = 0; virtual std::string currentURL() const = 0; virtual void copyCurrentHistory(ListInterface& destination) = 0; };

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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions