Question: HoneyDo: Saving Your Relationship One Program at a Time 10 Possible Points Due: Fri Feb 3, 2023 1:59pm IN PROGRESS Next Up: Submit Assignment Unlimited

 HoneyDo: Saving Your Relationship One Program at a Time 10 Possible

Points Due: Fri Feb 3, 2023 1:59pm IN PROGRESS Next Up: SubmitAssignment Unlimited Attempts Allowed Details Scenario: Your significant other has developed a

habit of sending you a list of items to pick up at

HoneyDo: Saving Your Relationship One Program at a Time 10 Possible Points Due: Fri Feb 3, 2023 1:59pm IN PROGRESS Next Up: Submit Assignment Unlimited Attempts Allowed Details Scenario: Your significant other has developed a habit of sending you a list of items to pick up at the grocery store before each of your date nights. While cute at first, the chore of trudging all around the store is growing tiresome. To save your relationship, you devise a plan to get all the items on the list as quickly as possible. Since you prefer to traverse the aisles of the store in a fixed order (you are a creature of habit), you resolve to re-order the list such that you would encounter each item sequentially as you traverse the store in your preferred manner. Genius! You even took it a step further and made a special trip to the store to write down the sequence of all the items you see while traversing the store in your preferred way. You call this your "canonical" ordering. Your assignment: Write a program called HoneyDo which will reorder a list of groceries based on a provided canonical ordering. Your program must read a list of groceries from a text file called "groceries.txt" wherein each item to be purchased is listed on its own line of the file (shown below). Your program should also read a separate file called "canonical.txt" which lists the sequence of all the grocery store items that you might encounter in their "canonical" ordering (also shown below). The output of your program is printed to the screen and shows both the original grocery list as well as the canonically re-ordered list (again, also shown below). Example of groceries.txt: milk bread onions cereal ice cream toothpaste apples frozen pizza Example of canonical.txt apples bananas onions deli meat soft drinks cheese chicken bread cereal mustard ketchup toothpaste frozen pizza burritos milk ice cream The output of the program is below: Your Original Order: milk bread onions cereal ice cream toothpaste apples frozen pizza Your canonical Order: apples onions bread cereal toothpaste frozen pizza milk ice cream

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!