Question
Please I need answers to these C++ questions. Its kinda urgent as well.... Task A Rolodex is a rotating file that is usually used to
Please I need answers to these C++ questions. Its kinda urgent as well....
Task A Rolodex is a rotating file that is usually used to record business contact information. Cards are inserted in alphabetic order by name. You operate the Rolodex by rolling it forwards or backwards until you find the information you need (or find the place where a new card should be inserted). Your task is to create a class that simulates a Rolodex and use it to implement a word-sorting program. The program starts with an empty Rolodex, then reads words from standard input and adds a card for each word into the appropriate position to maintain overall sorted order. To find the correct position, the Rolodex is rolled either backwards or forwards from the current card. When all input has been processed, the program moves the Rolodex to the beginning and then outputs each word in order, one per line.
Level 1: Basic operation Complete the implementation of Rolodex so that all the methods work correctly. The insert methods should leave the Rolodex positioned so that the current item is the one just inserted.
Level 2: No duplicates Modify the program so that the command line option -d (no duplicates) causes a new item to be inserted only if the item is not already present in the Rolodex. For example, if the input consisted of the text far far far away then the output would contain only two lines away far
Level 3: Deletion Modify the program such that an input string that begins with a - causes that word (without the -) to be deleted from the Rolodex instead of inserted. For example, if the input is the quick black fox jumps -black brown over the lazy dog then the output would contain the word brown but not black. Deleting a word should be implemented by moving the Rolodex to the position where the word would normally be inserted, but then deleting the current item if it matches the word (if it does not match, no action is performed). You will need to add a method to the Rolodex class that deletes the current item and leaves the Rolodex positioned so that the current item is the one following the deleted item if there is a following item, or the item preceding the deleted item otherwise. Hint: as part of your solution, consider the case where the input word is a - (i.e., a dash).
Level 4: Report Modify the program so that if it is run with the command line option -r (report), it outputs a report of the Rolodex operations rather than the words themselves. The report should consist of the following integer values separated by spaces: the number of items inserted, the number of duplicate items omitted (expected to be 0 unless the -d option is in effect), the number of items deleted, the number of times the rotateForward operation was performed, and the number of times the rotateBackward operation was performed. For example, if the input consisted of the text the quick brown fox jumps over the lazy dog then the output should read 9 0 0 5 8
Step 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