It is assumed you are keeping up to date with the lectures and labs.
Some additional git information is available through the
git quick notes,
git project/lab submission, and
lecture resources pages.
In this lab we start working with C++ classes, using them to build our own linked list class and then use that class in a small application.
Be sure to follow the course code standards. Marks will be deducted for failing to follow standards.
H (this menu) Q (end program) P (print all bugs in current list) F (print all current-list bugs relating to specific file) I (insert new bug into current list) L (lookup bug in current list) R (remove bug from current list) D (create second bugs list as duplicate of first) S (switch between working on first/second lists)Most of the user interaction for this program is already handled in the lab4.cpp file (e.g. getting and checking user commands and calling the appropriate buglist methods), so your task is getting the actual buglist class methods implemented correctly. The general linked-list concepts and logic we've worked with previously all still apply, but now we're using a class instead of plain structs to carry out the implementation. The big behavioural differences with past labs are how inserting, removing, and sorting are handled. In this lab, bug reports are stored in sorted order (by the bug name), and as each new item is inserted we find it's correct spot to insert. This makes insertion a bit more complex, but means we never need to sort the list (the items are always sorted because of the way we inserted them). In this lab we are also searching for and removing bugs by their name, rather than simply from the front of the list, so the remove method will also need particular care.
file buglist.h |
Available commands are: H (this menu) Q (end program) P (print all bugs in current list) F (print all current-list bugs relating to specific file) I (insert new bug into current list) L (lookup bug in current list) R (remove bug from current list) D (create second bugs list as duplicate of first) S (switch between working on first/second lists) Enter your next command (from HQPFILRDS) p Contents of list 1: Enter your next command (from HQPFILRDS) s Switching to list 2 Enter your next command (from HQPFILRDS) p Error: no list currently allocated for list 2 Enter your next command (from HQPFILRDS) s Switching to list 1 Enter your next command (from HQPFILRDS) i Enter the name of the new bug (no spaces) middle Enter the bug description (one line) eventually will be in mddle of list Enter the name of the file containing the bug (no spaces) lab1 Enter your next command (from HQPFILRDS) p Contents of list 1: middle(lab1): eventually will be in mddle of list Enter your next command (from HQPFILRDS) i Enter the name of the new bug (no spaces) first Enter the bug description (one line) gets to front of list Enter the name of the file containing the bug (no spaces) lab2 Enter your next command (from HQPFILRDS) p Contents of list 1: first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list Enter your next command (from HQPFILRDS) i Enter the name of the new bug (no spaces) very Enter the bug description (one line) ends up very last in list Enter the name of the file containing the bug (no spaces) lab1 Enter your next command (from HQPFILRDS) p Contents of list 1: first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) i Enter the name of the new bug (no spaces) second Enter the bug description (one line) will be second to last Enter the name of the file containing the bug (no spaces) lab2 Enter your next command (from HQPFILRDS) p Contents of list 1: first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) d Making list2 a duplicate of list1 Enter your next command (from HQPFILRDS) i Enter the name of the new bug (no spaces) fine Enter the bug description (one line) new front of list Enter the name of the file containing the bug (no spaces) lab1 Enter your next command (from HQPFILRDS) p Contents of list 1: fine(lab1): new front of list first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) s Switching to list 2 Enter your next command (from HQPFILRDS) p Contents of list 2: first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) l Enter the name of the bug of interest (no spaces) second Found: second(lab2): will be second to last Enter your next command (from HQPFILRDS) r Enter the name of the bug of interest (no spaces) middle Removed bug middle Enter your next command (from HQPFILRDS) p Contents of list 2: first(lab2): gets to front of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) s Switching to list 1 Enter your next command (from HQPFILRDS) p Contents of list 1: fine(lab1): new front of list first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) f Enter the name of the file of interest (no spaces) lab1 List 1 bugs related to lab1: fine(lab1): new front of list middle(lab1): eventually will be in mddle of list very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) d Making list2 a duplicate of list1 (deleting old list 2 before duplicating) Enter your next command (from HQPFILRDS) s Switching to list 2 Enter your next command (from HQPFILRDS) p Contents of list 2: fine(lab1): new front of list first(lab2): gets to front of list middle(lab1): eventually will be in mddle of list second(lab2): will be second to last very(lab1): ends up very last in list Enter your next command (from HQPFILRDS) q Bye! |