Question
writing an application to manage a browser's history. Essentially, the way the program works is that you visit a page and then the program adds
writing an application to manage a browser's history.
Essentially, the way the program works is that you visit a page and then the program adds that page to the 'history' that it's tracking. As you add more pages it'll keep adding these new pages to your history. You can then 'back up' in the history, much like you can push the 'Back button' in a real web browser. When you back up in the history the program moves the most recently visited page from your history into a list of 'future' pages, so that if you choose to then go forwards in your history you can revisit those pages. Here's an example transcript of one run of the program; (specifically, we're not going to track the URL, or the contents of the page, etc)
for clearly that in the history.cs must have
VistPage
MoveBackwards
MoveForwards
PrintAll
Example Transcript (user input is underlined, bold, and highlighted) Your options are: (1) View your history 2) Move 1 page backwards in your browser history' |3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 1 History: Previously visited pages: Pages in your future!! Your options are: (1) View your history 2) Move 1 page backwards in your browser history' (3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 1 (Google) History: Previously visited pages: Page 1 (Google) Pages in your future': Your options are: (1) View your history 12) Move i page backwards in your browser history! 3) Move 1 page forwards in your browser history' 14) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 2 (Hacker News) History: Previously visited pages: Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' (3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 3 (Ars Technica) History: Previously visited pages: |Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 12) Move 1 page backwards in your browser history! 3) Move 1 page forwards in your browser history' 4) Visit a new page $) Quit Type in your choice here: 4 What page are you visiting? XKCD History: Previously visited pages: XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' |3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? explainxked.com History: Previously visited pages: explainxkcd.com XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' 3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here:2 Moving backwards in your browser) history: History: Previously visited pages: XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your 'future': explainxked.com Example Transcript (user input is underlined, bold, and highlighted) Your options are: (1) View your history 2) Move 1 page backwards in your browser history' |3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 1 History: Previously visited pages: Pages in your future!! Your options are: (1) View your history 2) Move 1 page backwards in your browser history' (3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 1 (Google) History: Previously visited pages: Page 1 (Google) Pages in your future': Your options are: (1) View your history 12) Move i page backwards in your browser history! 3) Move 1 page forwards in your browser history' 14) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 2 (Hacker News) History: Previously visited pages: Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' (3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? Page 3 (Ars Technica) History: Previously visited pages: |Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 12) Move 1 page backwards in your browser history! 3) Move 1 page forwards in your browser history' 4) Visit a new page $) Quit Type in your choice here: 4 What page are you visiting? XKCD History: Previously visited pages: XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' |3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here: 4 What page are you visiting? explainxked.com History: Previously visited pages: explainxkcd.com XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your future': Your options are: 1) View your history 2) Move 1 page backwards in your browser history' 3) Move 1 page forwards in your browser history' 4) Visit a new page 5) Quit Type in your choice here:2 Moving backwards in your browser) history: History: Previously visited pages: XKCD Page 3 (Ars Technica) Page 2 (Hacker News) Page 1 (Google) Pages in your 'future': explainxked.comStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started