View difference between Paste ID: krFVJ26K and tV7p5yf8
SHOW: | | - or go back to the newest paste.
1
PASTEBINnew pastetrends 
2
search...
3
 
4
5
Guest User
6
-
7
SHARE
8
TWEET
9
10
Untitled
11
 A GUEST   APR 26TH, 2017   0   NEVER
12
13
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
14
rawdownloadcloneembedreportprint text 15.72 KB
15
Directions
16
///////////////////////////////////////////////////////////
17
BIT 143 - Assignment 2
18
DUE DATE: < Listed In Course Schedule >
19
Linked Lists and the 'Browser History' Application
20
           
21
            You are not allowed to work in groups this assignment.  For this assignment, you should start, finish, and do all the work on your own.  If you have questions, please contact the instructor.
22
 
23
Learning Objectives:
24
(This is a list of the major topics that you, as students, will learn in this assignment:)
25
Linked Lists
26
In this assignment, you will need to implement a simple linked list class (either a pure linked list class that is used by other classes, or else you will merge an implementation of a linked list class into another class).  Specifically, you will need to be able to add nodes to / remove nodes from the ends of the linked list.
27
 
28
Abstract Data Type(s)
29
In this assignment, you will need to select and implement an appropriate Abstract Data Type (although perhaps not a 'pure' implementation of said ADT).
30
 
31
Part 1: Writing the program
32
            Imagine that you're writing an application to manage a browser's history.  Because we want to keep things (relatively) simple for this homework assignment  we're only going to track the name of each page (specifically, we're not going to track the URL, or the contents of the page, etc).  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;
33
 
34
Example Transcript (user input is underlined, bold, and highlighted)
35
 
36
Your options are:
37
1) View your history
38
2) Move 1 page backwards in your 'browser history'
39
3) Move 1 page forwards in your 'browser history'
40
4) Visit a new page
41
5) Quit
42
Type in your choice here:1
43
 
44
History:
45
Previously visited pages:
46
Pages in your 'future':
47
 
48
Your options are:
49
1) View your history
50
2) Move 1 page backwards in your 'browser history'
51
3) Move 1 page forwards in your 'browser history'
52
4) Visit a new page
53
5) Quit
54
Type in your choice here:4
55
 
56
What page are you visiting?
57
Page 1 (Google)
58
History:
59
Previously visited pages:
60
Page 1 (Google)
61
Pages in your 'future':
62
 
63
Your options are:
64
1) View your history
65
2) Move 1 page backwards in your 'browser history'
66
3) Move 1 page forwards in your 'browser history'
67
4) Visit a new page
68
5) Quit
69
Type in your choice here:4
70
 
71
What page are you visiting?
72
Page 2 (Hacker News)
73
History:
74
Previously visited pages:
75
Page 2 (Hacker News)
76
Page 1 (Google)
77
Pages in your 'future':
78
 
79
Your options are:
80
1) View your history
81
2) Move 1 page backwards in your 'browser history'
82
3) Move 1 page forwards in your 'browser history'
83
4) Visit a new page
84
5) Quit
85
Type in your choice here:4
86
 
87
What page are you visiting?
88
Page 3 (Ars Technica)
89
History:
90
Previously visited pages:
91
Page 3 (Ars Technica)
92
Page 2 (Hacker News)
93
Page 1 (Google)
94
Pages in your 'future':
95
 
96
Your options are:
97
1) View your history
98
2) Move 1 page backwards in your 'browser history'
99
3) Move 1 page forwards in your 'browser history'
100
4) Visit a new page
101
5) Quit
102
Type in your choice here:4
103
 
104
What page are you visiting?
105
XKCD
106
History:
107
Previously visited pages:
108
XKCD
109
Page 3 (Ars Technica)
110
Page 2 (Hacker News)
111
Page 1 (Google)
112
Pages in your 'future':
113
 
114
Your options are:
115
1) View your history
116
2) Move 1 page backwards in your 'browser history'
117
3) Move 1 page forwards in your 'browser history'
118
4) Visit a new page
119
5) Quit
120
Type in your choice here:4
121
 
122
What page are you visiting?
123
explainxkcd.com
124
History:
125
Previously visited pages:
126
explainxkcd.com
127
XKCD
128
Page 3 (Ars Technica)
129
Page 2 (Hacker News)
130
Page 1 (Google)
131
Pages in your 'future':
132
 
133
Your options are:
134
1) View your history
135
2) Move 1 page backwards in your 'browser history'
136
3) Move 1 page forwards in your 'browser history'
137
4) Visit a new page
138
5) Quit
139
Type in your choice here:2
140
 
141
Moving backwards in your (browser) history:
142
History:
143
Previously visited pages:
144
XKCD
145
Page 3 (Ars Technica)
146
Page 2 (Hacker News)
147
Page 1 (Google)
148
Pages in your 'future':
149
explainxkcd.com
150
 
151
Your options are:
152
1) View your history
153
2) Move 1 page backwards in your 'browser history'
154
3) Move 1 page forwards in your 'browser history'
155
4) Visit a new page
156
5) Quit
157
Type in your choice here:2
158
 
159
 
160
Moving backwards in your (browser) history:
161
History:
162
Previously visited pages:
163
Page 3 (Ars Technica)
164
Page 2 (Hacker News)
165
Page 1 (Google)
166
Pages in your 'future':
167
XKCD
168
explainxkcd.com
169
 
170
Your options are:
171
1) View your history
172
2) Move 1 page backwards in your 'browser history'
173
3) Move 1 page forwards in your 'browser history'
174
4) Visit a new page
175
5) Quit
176
Type in your choice here:2
177
 
178
Moving backwards in your (browser) history:
179
History:
180
Previously visited pages:
181
Page 2 (Hacker News)
182
Page 1 (Google)
183
Pages in your 'future':
184
Page 3 (Ars Technica)
185
XKCD
186
explainxkcd.com
187
 
188
Your options are:
189
1) View your history
190
2) Move 1 page backwards in your 'browser history'
191
3) Move 1 page forwards in your 'browser history'
192
4) Visit a new page
193
5) Quit
194
Type in your choice here:2
195
 
196
Moving backwards in your (browser) history:
197
History:
198
Previously visited pages:
199
Page 1 (Google)
200
Pages in your 'future':
201
Page 2 (Hacker News)
202
Page 3 (Ars Technica)
203
XKCD
204
explainxkcd.com
205
 
206
Your options are:
207
1) View your history
208
2) Move 1 page backwards in your 'browser history'
209
3) Move 1 page forwards in your 'browser history'
210
4) Visit a new page
211
5) Quit
212
Type in your choice here:3
213
 
214
Moving backwards in your (browser) history:
215
History:
216
Previously visited pages:
217
Page 2 (Hacker News)
218
Page 1 (Google)
219
Pages in your 'future':
220
Page 3 (Ars Technica)
221
XKCD
222
explainxkcd.com
223
 
224
Your options are:
225
1) View your history
226
2) Move 1 page backwards in your 'browser history'
227
3) Move 1 page forwards in your 'browser history'
228
4) Visit a new page
229
5) Quit
230
Type in your choice here:3
231
 
232
Moving backwards in your (browser) history:
233
History:
234
Previously visited pages:
235
Page 3 (Ars Technica)
236
Page 2 (Hacker News)
237
Page 1 (Google)
238
Pages in your 'future':
239
XKCD
240
explainxkcd.com
241
 
242
Your options are:
243
1) View your history
244
2) Move 1 page backwards in your 'browser history'
245
3) Move 1 page forwards in your 'browser history'
246
4) Visit a new page
247
5) Quit
248
Type in your choice here:4
249
 
250
What page are you visiting?
251
New Page 4
252
History:
253
Previously visited pages:
254
New Page 4
255
Page 3 (Ars Technica)
256
Page 2 (Hacker News)
257
Page 1 (Google)
258
Pages in your 'future':
259
 
260
Your options are:
261
1) View your history
262
2) Move 1 page backwards in your 'browser history'
263
3) Move 1 page forwards in your 'browser history'
264
4) Visit a new page
265
5) Quit
266
Type in your choice here:1
267
 
268
History:
269
Previously visited pages:
270
New Page 4
271
Page 3 (Ars Technica)
272
Page 2 (Hacker News)
273
Page 1 (Google)
274
Pages in your 'future':
275
 
276
Your options are:
277
1) View your history
278
2) Move 1 page backwards in your 'browser history'
279
3) Move 1 page forwards in your 'browser history'
280
4) Visit a new page
281
5) Quit
282
Type in your choice here:5
283
            As you examine the above transcript you should notice that if you 'back up' in the history and then visit a new page the program will remove all the pages your 'future'.   Also note that backing up past the first entry is not possible, nor is it possible to move forwards when there's no items in the 'future'.
284
 
285
            You should base your program's design off one of the Abstract Data Types that we've examined.  The ADT should be implemented using a linked list, so that you get experience implementing linked lists.
286
 
287
Starter Project: You will be provided with a starter project that will provide you with a console-based user interface that will use the code that will use the BrowserHistory class that you implement in order to provide the functionality described in the previous paragraph.
288
 
289
The interface to the BrowserHistory class is defined below, so that you're clear on how the BrowserHistory class needs to behave.  You are free to create other classes ('helper classes', or auxiliary classes) that you use to implement the BrowserHistory class.
290
 
291
BrowserHistory Data & Methods
292
Data Field Name
293
Type
294
Description:
295
You're free to add any
296
 
297
data fields that you need to, in   
298
order to accomplish the objectives set forth in this assignment
299
 
300
Note: all data fields should be marked private (if you need to expose them, use Properties, or accessor/mutator methods)
301
Method Name
302
Returns
303
Description/Parameters:
304
<constructor>
305
Nothing, by definition
306
Any initialization that you need to do
307
VisitPage   void   
308
Parameters:
309
 string pageName: This is a text description of what the page is
310
This method will take the page's name, and immediately add that page to the 'previously visited' part of the browser's history.
311
 
312
MoveBackwards
313
 
314
 
315
void   
316
Parameters: None
317
 
318
If there's at least 1 page in the 'previously visited' part of the browser's history this method will remove it and add that item to the 'future history' of the browser.
319
This method does the opposite of the MoveForwards method.
320
MoveForwards
321
 
322
 
323
void   
324
Parameters: None
325
 
326
If there's at least 1 page in the 'future visited' part of the browser's history this method will remove it and add that item to the 'previously visited' part of the browser's history.
327
This method does the opposite of the MoveBackwards method.
328
PrintAll    void   
329
Parameters: None
330
 
331
If there are any pages in the history this method will print them all.  Note that you must print out all the pages in the 'previous' history, then print out all the pages in the 'future history', as shown in the transcript above.
332
Note: all methods should be marked public
333
 
334
Note: All methods should run in a minimum amount of time, and with a minimum amount of space (memory) consumed.  Using Big 'Oh' notation, all methods (except PrintAll) should run in O(1) time and space.
335
 
336
 
337
Group Work, Commenting:
338
 
339
            You are not allowed to work in groups for this assignment.  You should start, finish, and do all the work on your own.  If you have questions, please contact the instructor.
340
 
341
            Additionally, you should aggressively comment your code, paying particular attention to areas that are difficult to understand.  If you found something to be tricky when you wrote it, make sure to comment it so that the next person (the instructor, who's grading you) understands what your code is doing.  It is not necessary to comment every single line.
342
 
343
The purpose of new requirement is to both help you understand, and have you demonstrate, a thorough understanding of exactly how your program works.
344
 
345
Every file that you turn in should have:
346
 At the top of each file that you normally edit, you should put your name (first and last), the name of this class (“BIT 143”), and the year and quarter, and the assignment number, including the revision number, which starts at 0 (“A2.0”).  If you’re handing this in again for a regrade, make sure to increase the minor version number by one (from “A2.0”, to “A2.1").
347
You normally edit the C# source code files (.CS files), and any Word documents that you're handing in (if any).
348
You do not normally edit the .SLN or .CSPROJ files, and so you should not try to put this identifying information in those files.
349
 
350
In general, you should make sure to do the following before handing in your project:
351
All variables used should have meaningful names.
352
The code should be formatted consistently, and in an easy to read format.  
353
 
354
What to turn in:
355
 
356
·        A single electronic folder (a directory).  This folder should contain:
357
The source code for the program – all the .CS files in your project.
358
 
359
You should not include the bin or obj directories, nor anything from them.  I will dock you a couple points if you do.
360
 
361
How to electronically submit your homework:
362
 
363
There's a link on the homework page to the document that guides you through handing in your work.
364
 
365
///////////////////////////////////////////////////////////////////////////////////
366
//UserInterface.cs
367
//using System;
368
 
369
//namespace Helpdesk
370
//{
371
//    class UserInterface
372
//    {
373
//        public void RunProgram()
374
//        {
375
//            History browserHistory = new History();
376
 
377
//            bool fContinue = true;
378
//            string desc; // description of problem, for inputting new problems
379
 
380
//            while (fContinue)
381
//            {
382
//                int userChoice = -1;
383
//                while (userChoice < 1 || userChoice > 5)
384
//                {
385
//                    Console.WriteLine(); // visual spacer
386
//                    Console.WriteLine(" Your options are:");
387
//                    Console.WriteLine("1) View your history");
388
//                    Console.WriteLine("2) Move 1 page backwards in your 'browser history'");
389
//                    Console.WriteLine("3) Move 1 page forwards in your 'browser history'");
390
//                    Console.WriteLine("4) Visit a new page");
391
//                    Console.WriteLine("5) Quit");
392
//                    Console.Write("Type in your choice here:");
393
//                    if (!Int32.TryParse(Console.ReadLine(), out userChoice))
394
//                    {
395
//                        Console.WriteLine("You need to type in a number!");
396
//                    }
397
//                    Console.WriteLine(); // visual spacer
398
//                }
399
 
400
//                switch (userChoice)
401
//                {
402
//                    case 1:
403
//                        browserHistory.PrintAll();
404
//                        break;
405
//                    case 2:
406
//                        Console.WriteLine("Moving backwards in your (browser) history:");
407
//                        browserHistory.MoveBackwards();
408
//                        browserHistory.PrintAll();
409
//                        break;
410
//                    case 3:
411
//                        Console.WriteLine("Moving forwards in your (browser) history:");
412
//                        browserHistory.MoveForwards();
413
//                        browserHistory.PrintAll();
414
//                        break;
415
//                    case 4:
416
//                        Console.WriteLine("What page are you visiting?");
417
//                        String pg = Console.ReadLine();
418
//                        browserHistory.VisitPage(pg);
419
//                        browserHistory.PrintAll();
420
//                        break;
421
//                    case 5:
422
//                        Console.WriteLine("Thanks for using the program!\nGoodbye!\n\n");
423
//                        Console.WriteLine("<Press the enter key to exit>");
424
//                        Console.ReadLine();
425
//                        return;
426
//                }
427
//            }
428
//        }
429
//    }
430
//}
431
 
432
//////////////////////////////////////////////////////////////////////////
433
//Program.cs
434
//using System;
435
 
436
//namespace Helpdesk
437
//{
438
//    /// <summary>
439
//    ///
440
//    /// </summary>
441
//    class Program
442
//    {
443
//        static void Main(string[] args)
444
//        {
445
//            UserInterface ui = new UserInterface();
446
//            ui.RunProgram();
447
//        }
448
//    }
449
//}
450
 
451
///////////////////////////////////////////////
452
//History.cs
453
 
454
//using System;
455
//using System.Collections.Generic;
456
//using System.Text;
457
 
458
//namespace Helpdesk
459
//{
460
//    class History
461
//    {
462
//        public void PrintAll()
463
//        {
464
//        }
465
 
466
//        public void MoveBackwards()
467
//        {
468
//        }
469
 
470
//        public void MoveForwards()
471
//        {
472
//        }
473
 
474
//        public void VisitPage(string desc)
475
//        {
476
//        }
477
//    }
478
//}
479
RAW Paste Data
480
481
Directions
482
///////////////////////////////////////////////////////////
483
BIT 143 - Assignment 2
484
DUE DATE: < Listed In Course Schedule >
485
Linked Lists and the 'Browser History' Application
486
           
487
            You are not allowed to work in groups this assignment.  For this assignment, you should start, finish, and do all the work on your own.  If you have questions, please contact the instructor.
488
 
489
Learning Objectives:
490
(This is a list of the major topics that you, as students, will learn in this assignment:)
491
Linked Lists
492
In this assignment, you will need to implement a simple linked list class (either a pure linked list class that is used by other classes, or else you will merge an implementation of a linked list class into another class).  Specifically, you will need to be able to add nodes to / remove nodes from the ends of the linked list.
493
 
494
Abstract Data Type(s)
495
In this assignment, you will need to select and implement an appropriate Abstract Data Type (although perhaps not a 'pure' implementation of said ADT).
496
 
497
Part 1: Writing the program
498
            Imagine that you're writing an application to manage a browser's history.  Because we want to keep things (relatively) simple for this homework assignment  we're only going to track the name of each page (specifically, we're not going to track the URL, or the contents of the page, etc).  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;
499
500
Example Transcript (user input is underlined, bold, and highlighted)
501
502
Your options are:
503
1) View your history
504
2) Move 1 page backwards in your 'browser history'
505
3) Move 1 page forwards in your 'browser history'
506
4) Visit a new page
507
5) Quit
508
Type in your choice here:1
509
510
History:
511
Previously visited pages:
512
Pages in your 'future':
513
514
Your options are:
515
1) View your history
516
2) Move 1 page backwards in your 'browser history'
517
3) Move 1 page forwards in your 'browser history'
518
4) Visit a new page
519
5) Quit
520
Type in your choice here:4
521
522
What page are you visiting?
523
Page 1 (Google)
524
History:
525
Previously visited pages:
526
Page 1 (Google)
527
Pages in your 'future':
528
529
Your options are:
530
1) View your history
531
2) Move 1 page backwards in your 'browser history'
532
3) Move 1 page forwards in your 'browser history'
533
4) Visit a new page
534
5) Quit
535
Type in your choice here:4
536
537
What page are you visiting?
538
Page 2 (Hacker News)
539
History:
540
Previously visited pages:
541
Page 2 (Hacker News)
542
Page 1 (Google)
543
Pages in your 'future':
544
545
Your options are:
546
1) View your history
547
2) Move 1 page backwards in your 'browser history'
548
3) Move 1 page forwards in your 'browser history'
549
4) Visit a new page
550
5) Quit
551
Type in your choice here:4
552
553
What page are you visiting?
554
Page 3 (Ars Technica)
555
History:
556
Previously visited pages:
557
Page 3 (Ars Technica)
558
Page 2 (Hacker News)
559
Page 1 (Google)
560
Pages in your 'future':
561
562
Your options are:
563
1) View your history
564
2) Move 1 page backwards in your 'browser history'
565
3) Move 1 page forwards in your 'browser history'
566
4) Visit a new page
567
5) Quit
568
Type in your choice here:4
569
570
What page are you visiting?
571
XKCD
572
History:
573
Previously visited pages:
574
XKCD
575
Page 3 (Ars Technica)
576
Page 2 (Hacker News)
577
Page 1 (Google)
578
Pages in your 'future':
579
580
Your options are:
581
1) View your history
582
2) Move 1 page backwards in your 'browser history'
583
3) Move 1 page forwards in your 'browser history'
584
4) Visit a new page
585
5) Quit
586
Type in your choice here:4
587
588
What page are you visiting?
589
explainxkcd.com
590
History:
591
Previously visited pages:
592
explainxkcd.com
593
XKCD
594
Page 3 (Ars Technica)
595
Page 2 (Hacker News)
596
Page 1 (Google)
597
Pages in your 'future':
598
599
Your options are:
600
1) View your history
601
2) Move 1 page backwards in your 'browser history'
602
3) Move 1 page forwards in your 'browser history'
603
4) Visit a new page
604
5) Quit
605
Type in your choice here:2
606
607
Moving backwards in your (browser) history:
608
History:
609
Previously visited pages:
610
XKCD
611
Page 3 (Ars Technica)
612
Page 2 (Hacker News)
613
Page 1 (Google)
614
Pages in your 'future':
615
explainxkcd.com
616
617
Your options are:
618
1) View your history
619
2) Move 1 page backwards in your 'browser history'
620
3) Move 1 page forwards in your 'browser history'
621
4) Visit a new page
622
5) Quit
623
Type in your choice here:2
624
625
626
Moving backwards in your (browser) history:
627
History:
628
Previously visited pages:
629
Page 3 (Ars Technica)
630
Page 2 (Hacker News)
631
Page 1 (Google)
632
Pages in your 'future':
633
XKCD
634
explainxkcd.com
635
636
Your options are:
637
1) View your history
638
2) Move 1 page backwards in your 'browser history'
639
3) Move 1 page forwards in your 'browser history'
640
4) Visit a new page
641
5) Quit
642
Type in your choice here:2
643
644
Moving backwards in your (browser) history:
645
History:
646
Previously visited pages:
647
Page 2 (Hacker News)
648
Page 1 (Google)
649
Pages in your 'future':
650
Page 3 (Ars Technica)
651
XKCD
652
explainxkcd.com
653
654
Your options are:
655
1) View your history
656
2) Move 1 page backwards in your 'browser history'
657
3) Move 1 page forwards in your 'browser history'
658
4) Visit a new page
659
5) Quit
660
Type in your choice here:2
661
662
Moving backwards in your (browser) history:
663
History:
664
Previously visited pages:
665
Page 1 (Google)
666
Pages in your 'future':
667
Page 2 (Hacker News)
668
Page 3 (Ars Technica)
669
XKCD
670
explainxkcd.com
671
672
Your options are:
673
1) View your history
674
2) Move 1 page backwards in your 'browser history'
675
3) Move 1 page forwards in your 'browser history'
676
4) Visit a new page
677
5) Quit
678
Type in your choice here:3
679
680
Moving backwards in your (browser) history:
681
History:
682
Previously visited pages:
683
Page 2 (Hacker News)
684
Page 1 (Google)
685
Pages in your 'future':
686
Page 3 (Ars Technica)
687
XKCD
688
explainxkcd.com
689
690
Your options are:
691
1) View your history
692
2) Move 1 page backwards in your 'browser history'
693
3) Move 1 page forwards in your 'browser history'
694
4) Visit a new page
695
5) Quit
696
Type in your choice here:3
697
698
Moving backwards in your (browser) history:
699
History:
700
Previously visited pages:
701
Page 3 (Ars Technica)
702
Page 2 (Hacker News)
703
Page 1 (Google)
704
Pages in your 'future':
705
XKCD
706
explainxkcd.com
707
708
Your options are:
709
1) View your history
710
2) Move 1 page backwards in your 'browser history'
711
3) Move 1 page forwards in your 'browser history'
712
4) Visit a new page
713
5) Quit
714
Type in your choice here:4
715
716
What page are you visiting?
717
New Page 4
718
History:
719
Previously visited pages:
720
New Page 4
721
Page 3 (Ars Technica)
722
Page 2 (Hacker News)
723
Page 1 (Google)
724
Pages in your 'future':
725
726
Your options are:
727
1) View your history
728
2) Move 1 page backwards in your 'browser history'
729
3) Move 1 page forwards in your 'browser history'
730
4) Visit a new page
731
5) Quit
732
Type in your choice here:1
733
734
History:
735
Previously visited pages:
736
New Page 4
737
Page 3 (Ars Technica)
738
Page 2 (Hacker News)
739
Page 1 (Google)
740
Pages in your 'future':
741
742
Your options are:
743
1) View your history
744
2) Move 1 page backwards in your 'browser history'
745
3) Move 1 page forwards in your 'browser history'
746
4) Visit a new page
747
5) Quit
748
Type in your choice here:5
749
            As you examine the above transcript you should notice that if you 'back up' in the history and then visit a new page the program will remove all the pages your 'future'.   Also note that backing up past the first entry is not possible, nor is it possible to move forwards when there's no items in the 'future'.
750
751
            You should base your program's design off one of the Abstract Data Types that we've examined.  The ADT should be implemented using a linked list, so that you get experience implementing linked lists.
752
753
Starter Project: You will be provided with a starter project that will provide you with a console-based user interface that will use the code that will use the BrowserHistory class that you implement in order to provide the functionality described in the previous paragraph.
754
755
The interface to the BrowserHistory class is defined below, so that you're clear on how the BrowserHistory class needs to behave.  You are free to create other classes ('helper classes', or auxiliary classes) that you use to implement the BrowserHistory class.
756
757
BrowserHistory Data & Methods
758
Data Field Name
759
Type
760
Description:
761
You're free to add any
762
763
data fields that you need to, in	
764
order to accomplish the objectives set forth in this assignment
765
766
Note: all data fields should be marked private (if you need to expose them, use Properties, or accessor/mutator methods)
767
Method Name
768
Returns
769
Description/Parameters:
770
<constructor>
771
Nothing, by definition
772
Any initialization that you need to do
773
VisitPage	void	
774
Parameters:
775
 string pageName: This is a text description of what the page is
776
This method will take the page's name, and immediately add that page to the 'previously visited' part of the browser's history.
777
778
MoveBackwards
779
 
780
781
void	
782
Parameters: None
783
784
If there's at least 1 page in the 'previously visited' part of the browser's history this method will remove it and add that item to the 'future history' of the browser.
785
This method does the opposite of the MoveForwards method.
786
MoveForwards
787
 
788
789
void	
790
Parameters: None
791
792
If there's at least 1 page in the 'future visited' part of the browser's history this method will remove it and add that item to the 'previously visited' part of the browser's history.
793
This method does the opposite of the MoveBackwards method.
794
PrintAll	void	
795
Parameters: None
796
797
If there are any pages in the history this method will print them all.  Note that you must print out all the pages in the 'previous' history, then print out all the pages in the 'future history', as shown in the transcript above.
798
Note: all methods should be marked public
799
 
800
Note: All methods should run in a minimum amount of time, and with a minimum amount of space (memory) consumed.  Using Big 'Oh' notation, all methods (except PrintAll) should run in O(1) time and space.
801
802
 
803
Group Work, Commenting:
804
 
805
            You are not allowed to work in groups for this assignment.  You should start, finish, and do all the work on your own.  If you have questions, please contact the instructor.
806
 
807
            Additionally, you should aggressively comment your code, paying particular attention to areas that are difficult to understand.  If you found something to be tricky when you wrote it, make sure to comment it so that the next person (the instructor, who's grading you) understands what your code is doing.  It is not necessary to comment every single line.
808
 
809
The purpose of new requirement is to both help you understand, and have you demonstrate, a thorough understanding of exactly how your program works.
810
 
811
Every file that you turn in should have:
812
 At the top of each file that you normally edit, you should put your name (first and last), the name of this class (“BIT 143”), and the year and quarter, and the assignment number, including the revision number, which starts at 0 (“A2.0”).  If you’re handing this in again for a regrade, make sure to increase the minor version number by one (from “A2.0”, to “A2.1").
813
You normally edit the C# source code files (.CS files), and any Word documents that you're handing in (if any).
814
You do not normally edit the .SLN or .CSPROJ files, and so you should not try to put this identifying information in those files.
815
 
816
In general, you should make sure to do the following before handing in your project:
817
All variables used should have meaningful names.
818
The code should be formatted consistently, and in an easy to read format.   
819
 
820
What to turn in:
821
 
822
·        A single electronic folder (a directory).  This folder should contain:
823
The source code for the program – all the .CS files in your project.
824
 
825
You should not include the bin or obj directories, nor anything from them.  I will dock you a couple points if you do. 
826
 
827
How to electronically submit your homework:
828
 
829
There's a link on the homework page to the document that guides you through handing in your work.
830
831
///////////////////////////////////////////////////////////////////////////////////
832
//UserInterface.cs
833
//using System;
834
835
//namespace Helpdesk
836
//{
837
//    class UserInterface
838
//    {
839
//        public void RunProgram()
840
//        {
841
//            History browserHistory = new History();
842
843
//            bool fContinue = true;
844
//            string desc; // description of problem, for inputting new problems
845
846
//            while (fContinue)
847
//            {
848
//                int userChoice = -1;
849
//                while (userChoice < 1 || userChoice > 5)
850
//                {
851
//                    Console.WriteLine(); // visual spacer
852
//                    Console.WriteLine(" Your options are:");
853
//                    Console.WriteLine("1) View your history");
854
//                    Console.WriteLine("2) Move 1 page backwards in your 'browser history'");
855
//                    Console.WriteLine("3) Move 1 page forwards in your 'browser history'");
856
//                    Console.WriteLine("4) Visit a new page");
857
//                    Console.WriteLine("5) Quit");
858
//                    Console.Write("Type in your choice here:");
859
//                    if (!Int32.TryParse(Console.ReadLine(), out userChoice))
860
//                    {
861
//                        Console.WriteLine("You need to type in a number!");
862
//                    }
863
//                    Console.WriteLine(); // visual spacer
864
//                }
865
866
//                switch (userChoice)
867
//                {
868
//                    case 1:
869
//                        browserHistory.PrintAll();
870
//                        break;
871
//                    case 2:
872
//                        Console.WriteLine("Moving backwards in your (browser) history:");
873
//                        browserHistory.MoveBackwards();
874
//                        browserHistory.PrintAll();
875
//                        break;
876
//                    case 3:
877
//                        Console.WriteLine("Moving forwards in your (browser) history:");
878
//                        browserHistory.MoveForwards();
879
//                        browserHistory.PrintAll();
880
//                        break;
881
//                    case 4:
882
//                        Console.WriteLine("What page are you visiting?");
883
//                        String pg = Console.ReadLine();
884
//                        browserHistory.VisitPage(pg);
885
//                        browserHistory.PrintAll();
886
//                        break;
887
//                    case 5:
888
//                        Console.WriteLine("Thanks for using the program!\nGoodbye!\n\n");
889
//                        Console.WriteLine("<Press the enter key to exit>");
890
//                        Console.ReadLine();
891
//                        return;
892
//                }
893
//            }
894
//        }
895
//    }
896
//}
897
898
//////////////////////////////////////////////////////////////////////////
899
//Program.cs
900
//using System;
901
902
//namespace Helpdesk
903
//{
904
//    /// <summary>
905
//    /// 
906
//    /// </summary>
907
//    class Program
908
//    {
909
//        static void Main(string[] args)
910
//        {
911
//            UserInterface ui = new UserInterface();
912
//            ui.RunProgram();
913
//        }
914
//    }
915
//}
916
917
///////////////////////////////////////////////
918
//History.cs
919
920
//using System;
921
//using System.Collections.Generic;
922
//using System.Text;
923
924
//namespace Helpdesk
925
//{
926
//    class History
927
//    {
928
//        public void PrintAll()
929
//        {
930
//        }
931
932
//        public void MoveBackwards()
933
//        {
934
//        }
935
936
//        public void MoveForwards()
937
//        {
938
//        }
939
940
//        public void VisitPage(string desc)
941
//        {
942
//        }
943
//    }
944
//}
945
946
                
947
create new paste  /  dealsnew!  /  api  /  trends  /  syntax languages  /  faq  /  tools  /  privacy  /  cookies  /  contact  /  dmca  /  scraping  /  go  
948
Site design & logo © 2017 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- Dedicated Server Hosting by Steadfast