Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The owners of a number of small businesses have teamed up to offer a shared delivery service for their customers. Their customers can order items

The owners of a number of small businesses have teamed up to offer a shared delivery service for their customers. Their customers can order items online from any of their stores during the week, and then on Saturday, the store owners will work together to assemble the items and have them delivered as a single package to each customers home. This approach should cut down on delivery costs for the store owners, while providing a great service for their customers.

You have been hired to create a Python program that will take all of the orders placed for all of the stores each week, and summarize the information into an easy to read table that tells the store owners how many drivers will be needed to deliver all of the packages for that week. They will need a driver for each zone of the city where at least one delivery needs to be made, with a maximum of 10 deliveries per driver. So, for example, if there are 13 deliveries that need to made to the West zone of the city, 2 drivers will be needed for that zone.

The store owners also want to keep track of the cost of this new delivery service. Assuming they will pay their drivers $12 for every package that they deliver, your program should calculate the total delivery cost for the week. Your program should also calculate the percentage that this delivery cost is of the total amount purchased by all of the customers for the week. Both of these values should be displayed in the summary table.

In addition to calculating the above information, your program should also be able to create an invoice summarizing all of the items that will be delivered to a given address. Note that many different people living at the same address may have made orders on different days during the week, but all items that are to be delivered to the same address should be put together in a single delivery package.

Input You will be provided with THREE text files. These text files will be updated every week (on Saturday), so your program must be able to read in the most up-to-date information every time it is run.

The first text file is called products.txt, and it contains information about all of the products that all of the stores offer for purchase online. Specifically, each line contains a unique product ID, followed by a description of the product, followed by the products price in cents (so it is a whole number). All of

image text in transcribed

image text in transcribed

3. Quit >3 Thank you for using the Small Business Delivery Program! Goodbye.

the three text file used are

products.txt

GDN0001;Sunflower seeds;519 GDN0002;Lettuce seeds;329 GDN0003;Yellowfin zucchini seeds;549 GDN0004;Cherry tomato seeds;429 GDN0005;Fernleaf dill seeds;329 GDN0006;Orangelo thyme seeds;399 GDN0007;Broccolini seeds;579 GDN0008;Pumpkin seeds;329 GDN0009;Sweet pea seeds;429 GDN0010;Marigold seeds;329 GDN0011;Goji berry seeds;469 GDN0012;Garden tools (5-pc);2599 GDN0013;Garden gloves (S);699 GDN0014;Garden gloves (M);799 GDN0015;Garden gloves (L);899 GDN0016;Water hose (25 ft);2250 GDN0017;Indoor lime tree;4999 GDN0018;Indoor flamingo flower;1999 GDN0019;Indoor violet;899 GDN0020;Indoor orchid;3999 BK0001;The Day the Crayons Quit;2380 BK0002;The Giving Tree;2199 BK0003;Where the Wild Things Are;995 BK0004;Oh the Places You'll Go;2461 BK0005;Green Eggs & Ham;1299 BK0006;Velveteen Rabbit;1999 BK0007;Winnie the Pooh;1099 BK0008;The Very Hungry Caterpillar;1499 BK0009;Goodnight Moon;1039 BK0010;The Gruffalo;1320 BK0011;Charlotte's Web;1099 BK0012;Little Prince;1495 BK0013;Cat in the Hat;1299 BK0014;Secret Garden;2299 BK0015;Anne of Green Gables;1800 BK0016;James & the Giant Peach;899 BK0017;Peter Rabbit Collection;2995 BK0018;Hunger Games Set;4999 BK0019;Harry Potter Box Set;10000 BK0020;Lord of the Rings;16000 TY0001;500pc puzzle:dragons;1549 TY0002;100pc puzzle:space;1399 TY0003;200pc puzzle:dinosaurs;1449 TY0004;300pc puzzle:underwater adventure;1499 TY0005;750pc puzzle:tropical birds;2499 TY0006;1000pc puzzle:wolves;2099 TY0007;1500pc puzzle:world map;2699 TY0008;2000pc puzzle:castle;3499 TY0009;5000pc puzzle:sistine chapel;8999 TY0010;18000pc puzzle:paradise;16999 TY0011;3D puzzle:Eiffel tower;3699 TY0012;3D puzzle:Statue Liberty;3699 TY0013;3D puzzle:Big Ben;2849 TY0014;Board game:Ticket to Ride;6999 TY0015;Board game:Monopoly;1999 TY0016;Board game:Risk;3999 TY0017;Board game:Scrabble;2499 TY0018;Board game:Trivial Pursuit;2999 TY0019;Board game:Catan;5999 TY0020;Yahtzee;1493

zones.txt

West#T5M,T5N,T5P,T5R,T5S,T5T,T5V,T6M North-West#T5X,T6V,T5E,T5L,T5G,T5H,T5K,T5J South-West#T6G,T6H,T6J,T6R,T6W Millwoods#T6K,T6L,T6N,T6T,T6X South-East#T6A,T6B,T6C,T6E,T6P North-East#T5A,T5B,T5C,T5W,T5Y,T5Z,T6S

orders.txt

2021-01-17%Fiona O'Byrne%13420-114 Ave T5M 2Y5%GDN0001%2 2021-01-17%Fiona O'Byrne%13420-114 Ave T5M 2Y5%GDN0002%1 2021-01-17%Fiona O'Byrne%13420-114 Ave T5M 2Y5%GDN0004%1 2021-01-17%Fiona O'Byrne%13420-114 Ave T5M 2Y5%GDN0003%1 2021-01-20%Fiona O'Byrne%13420-114 Ave T5M 2Y5%GDN0012%3 2021-01-19%Andrew Jackson%13420-114 Ave T5M 2Y5%GDN0008%1 2021-01-18%Archibald Sussex-Mountbatten%8310-88 Ave T6C 1L1%BK0020%1 2021-01-17%Susie Qu%2610 Hewes Way T6L 0A9%BK0019%1 2021-01-20%Max Smart%11051-125 St T5M 0M2%BK0018%1 2021-01-20%John Doe%12710-131 Ave T5L 2Z6%BK0017%1 2021-01-17%Mary Alice Wong%9915-67 St T6A 0H2%BK0016%1 2021-01-21%Jane Doe%11117-127 St T5M 0T5%BK0015%1 2021-01-17%Robert Smith%9010-156 St T5R 5X7%BK0014%1 2021-01-17%Darcie Morgan%7 Sir Winston Churchill Square T5J 2V4%BK0013%1 2021-01-17%Molly Dixon%10707-100 Ave T5J 3M1%BK0012%1 2021-01-17%Evelyn Powell%2702-17 St T6T 0X1%BK0011%1 2021-01-17%Elizabeth Bennett%818 Webber Greens Dr T5T 4K5%BK0010%1 2021-01-17%Christina Ramirez%17650-69 Ave T5T 3X9%BK0009%1 2021-01-19%Penelope Ward%8331-104 St T6E 4E9%BK0008%1 2021-01-18%Joe Bailey%8715-153 St T5R 1P1%BK0007%1 2021-01-17%Adele Bateman%15451-84 Ave T5R 3Y1%BK0006%1 2021-01-22%Neil Martin%11522-92 St T5G 0Z7%BK0005%1 2021-01-22%Thomas Fitzpatrick%9735-144 St T5N 2T3%BK0004%1 2021-01-20%Darren Tomlinson%13712-104 Ave T5N 0W4%TY0002%1 2021-01-17%Amanda Burns%11555-95 St T5G 1L5%BK0003%1 2021-01-17%Aidan Ryan%12940-129 St T5L 1J3%BK0002%1 2021-01-18%Emma Taylor%12950-118 St T5E 5L2%BK0001%1 2021-01-18%Emma Taylor%12950-118 St T5E 5L2%TY0001%1 2021-01-20%Darren Tomlinson%13712-104 Ave T5N 0W4%BK0020%1 2021-01-17%Yang Liu%8620-91 St T6C 3N2%BK0020%1 2021-01-17%Yang Liu%8620-91 St T6C 3N2%TY0003%1 2021-01-17%Clive Knight%11124-130 St T5M 0J2%BK0020%1 2021-01-17%Clive Knight%11124-130 St T5M 0J2%TY0004%1 2021-01-19%Amir Hamed%18710-72 Ave T5T 5E9%BK0020%1 2021-01-19%Amir Hamed%18710-72 Ave T5T 5E9%TY0005%1 2021-01-18%Hayley Jacobs%11515-127 St T5M 0V4%BK0020%1 2021-01-18%Hayley Jacobs%11515-127 St T5M 0V4%TY0006%1 2021-01-19%Beverly Crowley%13215-113a St T5E 5B9%BK0020%1 2021-01-19%Beverly Crowley%13215-113a St T5E 5B9%TY0007%1 2021-01-17%Alan Bateman%7920-94 Ave T6C 1W4%BK0020%1 2021-01-17%Alan Bateman%7920-94 Ave T6C 1W4%TY0008%1 2021-01-20%Yasmin Ali%9425-132 Ave T5E 0Y4%BK0020%1 2021-01-20%Yasmin Ali%9425-132 Ave T5E 0Y4%TY0009%1 2021-01-22%Michael Hawthorn%13110-91 St T5E 3P6%BK0020%1 2021-01-22%Michael Hawthorn%13110-91 St T5E 3P6%TY0010%1

67% O, Assignment 1_Deliveries.pdf Page 2 of 7 View 6 Zoom to Fit Previous Next Zoom Share Print Actual Size Magnity Inspector Slideshow Scale Highlight Rotate Markup these items are separated by a semicolon (";"), as can be seen in the sample products.txt provided with the assignirent description The only valid options for the user to enter are the numbers 1, 2, or 3. If the user enters an invalid choke your program should display an error message and then re-prompt the user to enter a valid choke. It should continue to reprompt unti a valid choice is entered. For example: Welchen11 118iras livery Program The second text file is called orders.txt, and it contains information about all of the items purchased during the current weck Specifically cachine contains information about onc product that has been purchased the date of the purchase vw-tum-dd). eg 2021-01-18 represents January 18, 2021 the customer's name the customer's complete address with the postal code at the very end. The format of a pastal code is 3 characters followed by a single space, followed by 3 characters, eg TSG 2EB. You can ume that all postal codes provided in anders.txt are correct and valid. the product in of the item purchased. . the number of these items that were purchased Allpeces of information are separated by a percent sign/"*"), as can be seen in the sample orders.txt provided with the assignment description MH4 wuld you like to do? 1. Display DELIVERY SUNDARY CABLE for this week 2. Display and CYS DELIVERY ORDER for specizic address 2. Quid Sorry, invalid untry. Plurice From 1 to 3. Sorry, invalid untry. PIHA Here rum 1 Lu. Option 1: When the user chooses option 1, the delivery summary table should be displayed, and should look like this sample output: The third text file is called cones.l, and it contains information about which areas of the city (as Indicated by the first 3 characters of the postal codes are included in each delivery zane. Eachine will contain the name of the zone, followed by a V, followed by the 3-character starting sequence of all postal codes that belong to that core. If there are muluple 3-character postal code slartire secuences far that one, they will all be listed on the same line, separated by a comma("). For example, there are five postal code starting sequences in the South-East zone of Edmonton, and would be listed as: Welcome to the mall Busineas Delivery Program What would you luku to do? 1. Displey JELIVERY SUMMARY TABLE for this week 2. Display and seve DELIVERY ORDER for speciic addcexy South-Eesti'16A, 161, 160, 286, 16F Please keep in mind that as this celivery service becomes more popular, the rear of small business owners may decide to split the current zores a into smaller delivery zones or expand their delivery to areas outside the city. Sa your program must read in the latest Information from zones.txt cach week (i.e. every time the program is run). +------------ | City Cliveri 1. VMEN Output I will I North-Wear 1 2 20 5 13 IL Menu: Your program should output a menu which al cas the user to keen selecting options until she chooses to quit the program. It should look exactly like this: | Tota: Livex coded | Tota. Gellvery set Leliwy wol/pusaha 5 360.00 14.011 He the stat humine livery Program Only zones that have at least one delivery should be included in the table. The delivery zones should be displayed in alphabetical order What would you like 1. Diaplay DELIVERY SINARY TALE Per this week 2. Disp-zy and save DELIVERY CRDER COI seccitis adaress 3. Quit The table should be formatted exactly as in the sample output. Specifically, pay attention to the column widths, text alignments and borders. For example, the Delivery Zone column is left aligned, the Deliveries column is center aligned, and the Drivers column is center aligned. In the bottom section of 104.71 ) O, Assignment 1_Deliveries.pdf Page 4 of 7 View Page 4 of 7 Share Print Actual Size 67% 6 Scale Zoom to Fit Previous Next Zoom Magnity Inspector Slideshow Highlight Rotate Markup Address: 13420-114 Ave ESM 245 Delivery tor: 13020-110 Ave II 2X5 the table, you can safely assume that the total delivery cost will never be greater than $99,999.99, and you will always want to show the delvery cost/purchases as a percentage rounded to one decima reht aligned After the table has been disalayca, the main menu is displayed again for the user to make another choice Dyte Iter Price -------------------------- 132 x Sunriver seeds $ 10.32 TAY 7 1191 x LATUCA BAADA $ TAX 1) 1132 x Cherry tomato Anna 4.29 TAX 15 19 x Yellox in zochici. $ JAN 2900 X Pumpkin seeds 9 3.29 JAN 20 003 x Garder tooly 15-pe) 77.97 Option 2: When the user chooses option 2, she is prompted to enter a complete address. If it does not match an address from orders.txt exactly, an error message is displayed and the main menu is displayed again for the user ta make anather choice. $ Welcome to the SLL Banana Salivary Program The format of the delivery order should be exactly as shown above. In particular, note that the address is redisplayed (right-aligned, at the top of the delivery order. If the address is longer than 30 characters, only the first 29 characters are displayed followed by an asterisk". What would you like to do? 1. Display DELIVERY SUNARY TELL Eor this week 2. Display and wave DELIVERY CROCR Eor vyecific adines 3. Quit Address: 123 doesn't exist avulid wid.cess The items should be sorted in order of delivery date. (If multiple Items were ordered on the same date, the relative order of those items does not matter.! The first column contains the date the date should be displayed as the first three letters of the month (all capitalized followed by a single space and the two digit day. All together, this should always occupy a field width of 6 (as shown). The second column contains the number of items ordered, along with the description. The number of iters will not exceed 999, and should be right aligned in a field width of 3 with leading acros. If the item description is longer than 20 characters, only the first 19 characters should be displayed, followed by an asterisk (*". The third column contains the total arice charged for that line item. You can assume that the price will not exceed $99,999.99 Welcome to the Small Buanasa Delivery Program What would you like to do? 2. Diaplay DELIVERY SINARY THELE for this week 2. Display and wave DELIVERY CRUER Eor vyecific adeiress 3. Quit At the very bottom of the delivery order, the total amount paid for the package delivered should be listed, aligned under the third coun. You can assure that the total will not exceed $99,999.99 If a valid address is entered a delivery order listing all items in the package delivered to that actress is displayed on the screen AND saved to a text file called invoice.txt. Note that the user can select option 2 before selecting option 1. After the delivery order has been displayed, the main menu is displayed again for the user to make another choice Welcome to the Small Busines Jelivery Program Option: when the user chacses opt on 3, a thank you message will be di salay and the program wil end What would you like to do? 1. Diaplay DELIVERY SINARY TALE Per this week 2. Disp-zy and save DELIVERY CRDER COF Specific adaress 3. Quit Welcone to the Snail Less Delivery Frogram wiat would you like to do? 1. Display TVRRY BUIMARY TART for this week 7. Display and VA DELIVERY ORDER for faci'ic address 67% O, Assignment 1_Deliveries.pdf Page 2 of 7 View 6 Zoom to Fit Previous Next Zoom Share Print Actual Size Magnity Inspector Slideshow Scale Highlight Rotate Markup these items are separated by a semicolon (";"), as can be seen in the sample products.txt provided with the assignirent description The only valid options for the user to enter are the numbers 1, 2, or 3. If the user enters an invalid choke your program should display an error message and then re-prompt the user to enter a valid choke. It should continue to reprompt unti a valid choice is entered. For example: Welchen11 118iras livery Program The second text file is called orders.txt, and it contains information about all of the items purchased during the current weck Specifically cachine contains information about onc product that has been purchased the date of the purchase vw-tum-dd). eg 2021-01-18 represents January 18, 2021 the customer's name the customer's complete address with the postal code at the very end. The format of a pastal code is 3 characters followed by a single space, followed by 3 characters, eg TSG 2EB. You can ume that all postal codes provided in anders.txt are correct and valid. the product in of the item purchased. . the number of these items that were purchased Allpeces of information are separated by a percent sign/"*"), as can be seen in the sample orders.txt provided with the assignment description MH4 wuld you like to do? 1. Display DELIVERY SUNDARY CABLE for this week 2. Display and CYS DELIVERY ORDER for specizic address 2. Quid Sorry, invalid untry. Plurice From 1 to 3. Sorry, invalid untry. PIHA Here rum 1 Lu. Option 1: When the user chooses option 1, the delivery summary table should be displayed, and should look like this sample output: The third text file is called cones.l, and it contains information about which areas of the city (as Indicated by the first 3 characters of the postal codes are included in each delivery zane. Eachine will contain the name of the zone, followed by a V, followed by the 3-character starting sequence of all postal codes that belong to that core. If there are muluple 3-character postal code slartire secuences far that one, they will all be listed on the same line, separated by a comma("). For example, there are five postal code starting sequences in the South-East zone of Edmonton, and would be listed as: Welcome to the mall Busineas Delivery Program What would you luku to do? 1. Displey JELIVERY SUMMARY TABLE for this week 2. Display and seve DELIVERY ORDER for speciic addcexy South-Eesti'16A, 161, 160, 286, 16F Please keep in mind that as this celivery service becomes more popular, the rear of small business owners may decide to split the current zores a into smaller delivery zones or expand their delivery to areas outside the city. Sa your program must read in the latest Information from zones.txt cach week (i.e. every time the program is run). +------------ | City Cliveri 1. VMEN Output I will I North-Wear 1 2 20 5 13 IL Menu: Your program should output a menu which al cas the user to keen selecting options until she chooses to quit the program. It should look exactly like this: | Tota: Livex coded | Tota. Gellvery set Leliwy wol/pusaha 5 360.00 14.011 He the stat humine livery Program Only zones that have at least one delivery should be included in the table. The delivery zones should be displayed in alphabetical order What would you like 1. Diaplay DELIVERY SINARY TALE Per this week 2. Disp-zy and save DELIVERY CRDER COI seccitis adaress 3. Quit The table should be formatted exactly as in the sample output. Specifically, pay attention to the column widths, text alignments and borders. For example, the Delivery Zone column is left aligned, the Deliveries column is center aligned, and the Drivers column is center aligned. In the bottom section of 104.71 ) O, Assignment 1_Deliveries.pdf Page 4 of 7 View Page 4 of 7 Share Print Actual Size 67% 6 Scale Zoom to Fit Previous Next Zoom Magnity Inspector Slideshow Highlight Rotate Markup Address: 13420-114 Ave ESM 245 Delivery tor: 13020-110 Ave II 2X5 the table, you can safely assume that the total delivery cost will never be greater than $99,999.99, and you will always want to show the delvery cost/purchases as a percentage rounded to one decima reht aligned After the table has been disalayca, the main menu is displayed again for the user to make another choice Dyte Iter Price -------------------------- 132 x Sunriver seeds $ 10.32 TAY 7 1191 x LATUCA BAADA $ TAX 1) 1132 x Cherry tomato Anna 4.29 TAX 15 19 x Yellox in zochici. $ JAN 2900 X Pumpkin seeds 9 3.29 JAN 20 003 x Garder tooly 15-pe) 77.97 Option 2: When the user chooses option 2, she is prompted to enter a complete address. If it does not match an address from orders.txt exactly, an error message is displayed and the main menu is displayed again for the user ta make anather choice. $ Welcome to the SLL Banana Salivary Program The format of the delivery order should be exactly as shown above. In particular, note that the address is redisplayed (right-aligned, at the top of the delivery order. If the address is longer than 30 characters, only the first 29 characters are displayed followed by an asterisk". What would you like to do? 1. Display DELIVERY SUNARY TELL Eor this week 2. Display and wave DELIVERY CROCR Eor vyecific adines 3. Quit Address: 123 doesn't exist avulid wid.cess The items should be sorted in order of delivery date. (If multiple Items were ordered on the same date, the relative order of those items does not matter.! The first column contains the date the date should be displayed as the first three letters of the month (all capitalized followed by a single space and the two digit day. All together, this should always occupy a field width of 6 (as shown). The second column contains the number of items ordered, along with the description. The number of iters will not exceed 999, and should be right aligned in a field width of 3 with leading acros. If the item description is longer than 20 characters, only the first 19 characters should be displayed, followed by an asterisk (*". The third column contains the total arice charged for that line item. You can assume that the price will not exceed $99,999.99 Welcome to the Small Buanasa Delivery Program What would you like to do? 2. Diaplay DELIVERY SINARY THELE for this week 2. Display and wave DELIVERY CRUER Eor vyecific adeiress 3. Quit At the very bottom of the delivery order, the total amount paid for the package delivered should be listed, aligned under the third coun. You can assure that the total will not exceed $99,999.99 If a valid address is entered a delivery order listing all items in the package delivered to that actress is displayed on the screen AND saved to a text file called invoice.txt. Note that the user can select option 2 before selecting option 1. After the delivery order has been displayed, the main menu is displayed again for the user to make another choice Welcome to the Small Busines Jelivery Program Option: when the user chacses opt on 3, a thank you message will be di salay and the program wil end What would you like to do? 1. Diaplay DELIVERY SINARY TALE Per this week 2. Disp-zy and save DELIVERY CRDER COF Specific adaress 3. Quit Welcone to the Snail Less Delivery Frogram wiat would you like to do? 1. Display TVRRY BUIMARY TART for this week 7. Display and VA DELIVERY ORDER for faci'ic address

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

What are some advantages and disadvantages of secondary data? lPO05

Answered: 1 week ago

Question

4. What does an expert do?

Answered: 1 week ago