Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having a lot of trouble with python. I have uploaded the homework document and I do not know where to get started. It

I am having a lot of trouble with python. I have uploaded the homework document and I do not know where to get started. It involves the main function and importing csv files. I have attached the instructions to the assignment in these pictures. Do you have any tips or suggestions on how to code this?

Jeremy M

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
AutoSave m [53 File Home Insert Draw Design Layout References Mailings Review View Help Picture Format i3 Share 5' Comments A ,OFind v 4. [an X, Calibri(Body) v11 vA' A\" Aav Po :AaBchDdAaBchDd AaBchDd 1. AaBbCi: AaBbCCDt [l3 - (9b; Replace _ _ ' _ . Paste 6 B I E v ab x2 ,6 Av I V A V 'iNo Span" Headmw Headingz Headings % selectv Dictate Sensitivity Editor Clipboard is. Font IE. Paragraph is. Styles l Editing Voice Sensit'wity Editor A Getting Started O Open IDLE > open the Editor Window (File >NEW) 0 Click File > Save As... - Locate your Chapter 6 folder for this course 0 Save your file as: MI53301-Ch6-HW-customerFileMenu.py Instructions 0 Add code to import the csv & gsmodules. - Add global constants for your customer file and the backup le. 0 FY]: None of these functions will have a return value. 1. Main 0 Inside of your main() function, display the menu below. Allow the user to enter a choice and based on their choice invoke the correct function. Place the menu code in a while loop in to allow the user to continue making choices. The loop should run as long as the user has not entered 99 to exit. This will allow the user to press 1 to view the customer list, then 3 to enter a customer, and continue to use any other option until they are ready to exit the application. Vou should write each function header now and, in each function, simply type a print statement (e.g. display \"option 1")for now so that you can test that the menu is working. Make sure to test the menu choices and loop completely before moving to the next step. 0 Handle basic validation: display an error message if an invalid choice is entered. O Ensure that the main() function simply handles the menu as the other logic will be within each function. Thus, you will not be opening the file within main() as each function will handle opening the file in whatever manner it requires (i.e. for reading or writing) as well as closing the file when it is done. Victorino Customer Data *x******x***************************************** 1 View customer list 2 Lookup a customer 3 Enter new customer 4 Update a customer 5 Delete a customer 7 7 Copy customer data from BKUP (for testing only) 99 * Exit Enter a menu choice: AAAZAJHQMLUQDHELUU 1297 words 3)} AutoSave On . MIS3301-Ch6-HW-Customer-FileMenu.docx - Last Modified: 2h ago O Search Jeremy Mitschke JM X File Home Insert Draw Design Layout References Mailings Review View Help Picture Format Share Comments V 11 ~ A" A" Aa Ap EVEEVENT Find Calibri (Body) AaBbCcDd AaBbCcDd AaBbCcDd 1. AaBbCc AaBbCcD( LE Gic Replace Past BIUab X x A LA 1 Normal 1 No Spac... Heading 1 Heading 2 Heading 3 Dictate Sensitivity Editor - Select Clipboard IS Font Paragraph Styles Editing Voice Sensitivity Editor 2. View customer list Write a function to display all customers in the file as shown below. First, open the CSV file for reading. Next, display the title line: *** Customer List ***, field names, row of hyphens, list of all customer data properly formatted, and finally display the total number of customers. Achieve this step in its entirety before moving to the next step. . Note: This function will execute who the user selects menu option 1 to display the list of customers. The first line in the output screenshot below is the last line of the main menu screenshot shown above; do not prompt the user to enter a menu choice in this function as that should only occur in main() - this note is also true for all of the remaining functions. Enter a menu choice: * * * Customer List * * * Cust ID Last Name First Name 101 Carey Sue 102 Jones Melody 103 Romo Anne 104 Campbell Bryson 105 Wright John 106 Prescott Cheyenne 107 Nguyen Troy 108 Romo Megan 109 Smith Jason 110 Preston Bob >>> Total customers: 10 3. Lookup a customer . Write a function that allows the user to enter a customer ID, then retrieve the information for that customer from the CSV file. Also, let them know if a record was not found Achieve this step in its entirety before moving to the next step Enter a menu choice: 2 Enter a customer ID: 101 * * * Lookup Customer * * * Customer ID: 101 Last name : Carey First name : Bob 1297 words X Focus + 100% Type here to search O w x 12:30 PM E 3/29/2021AutoSave m [53 File Home Insert Draw Design Layout References Mailings Review View Help Picture Format i3 Share 5' Comments A ,Orind v 4. 2i . . ~ v i i la\" Calibri (Body) v 11 v A A Aav Po \"AaBchdeAaBchDd AaBchDd 1A AaBbCi: AaBbCCDt [a - (9b; Replace _ _ ' _ . Paste 6 B I E v ab x2 ,6 Av I V A V 'iNo Span" Headmw Headingz Headings % selectv Dictate Sensitivity Editor Clipboard is. Font IE. Paragraph is. Styles l Editing Voice Sensit'wity Editor A 3. Lookup a customer 0 Write a function that allows the user to enter a customer ID, then retrieve the information for that customer from the CSV file. Also, let them know ifa record was not found Achieve this step in its entirety before moving to the next step, Enter a menu choice: 2 Enter a customer ID: 101 *** Lookup Customer *** Customer ID: 101 Last name: Carey First name: Bob 4. Enter new customer O Write a function that allows the user to enter a new customer and add this data to the bottom ofthe CSV file, Achieve this step in its entirety before moving to the next step' You can test if the data was properly added by going back to menu option #1 to re-display the customer list (or by opening the CSV file). O Handle basic validation: do not allow a user to enter a new record without all 3 values having been entered 0 Next, I recommend that you do Step #7. In the event that your data is destroyed, you can easily copy it back with option 7. If you somehow delete both the real file & the backup file, just grab a new copy from Canvas' Enter a menu choice: 3 *** Enter New Customer *** Enter customer ID: 999 Enter last name: Bear Enter first name: Bobby STATUS: Customer record saved! 1297 words T' AX ,0 Type here to search AutoSave m [53 File Home Insert Draw Design Layout References Mailings Review View Help Picture Format i3 Share 5' Comments A _ _ ,. c . i i r .g A ,OFind V _% la\" [Er Calibri (Body) v 11 v A A Aar \"o :: V s: r ' \"AaBchDdu AaBchDd AaBchDd 1. AaBbCi: AaBchDr (9b RE I E . c pace . .. . . Paste 2 '_ = - , , Dictate Sensitivity Editor V 6 B I g V ab x2 x Av I V A V ;_ = llNoSpac... Headingl HeadingZ Headings I} Seledv v Clipboard is. Font is. Paragraph is. Styles is. Editing Voice Sensit'wity Editor A 5. Update a customer - Write a function that allows a user to update an existing customer's data in the CSV file. Allow the user to not have to update all fields. In this example, the user only updated the last name. Notify the user if the record was updated. Also, notify them when a record was not found: Achieve this step in its entirety before moving to the next step. I You can test if the data was properly updated by going back to menu option #1 to re-display the customer list (or by opening the CSV file). Enter a menu cholce: 4 Enter a customer ID: 101 *** Update Customer *** >>> Enter new value or press enter to skip Enter new customer id: Enter new last name: Doe Enter new first name: STATUS: Customer updated! 6. Delete a customer O Write a function that allows a user to delete an existing customer from the CSV file. Upon entering a customer ID, display the customer data and ask the user for confirmation that they want to delete this customer. Notify the user if the record was deleted. Also notify them when a record was not found. Achieve this step in its entirety before moving to the next step. 0 You can test if the data was properly deleted by going back to menu option #1 to re-display the customer list (or by opening the CSV file). Enter a menu choice: 5 Enter a customer ID: 999 *** Delete Customer *** Customer ID: 999 Last name: Bear First name: Bobby Are you sure you want to delete (y)? y 1297 words I331 33: Focus ,0 Type here to search AutoSave m [IE/\"K3 tomeirFileMenudo ' emy Mitschke File Home Insert Draw Design Layout References Mailings Review View Help Picture Format r3 Share 5' Comments A v A F' d v _ la\" 2i, Calibri (Body) v 11 v A A Aa v #0 'O '" # P t [a i: L ('b' Raplace D'ct t s 'i' 'ty Ed't as e 2 ' ' ' _ | a e ensi IVI | or V 6 B I g v ab x2 x A v i v A V l No Spam. Heading 1 Heading 2 Heading 3 V b Select V v Clipboard is. Font IE. Paragraph is. Styles E Editing Voice Sensit'wity Editor A 6. Delete a customer 0 Write a function that allows a user to delete an existing customer from the CSV file, Upon entering a customer ID, display the customer data and ask the user for confirmation that they want to delete this customer. Notify the user if the record was deleted. Also notify them when a record was not found. Achieve this step in its entirety before moving to the next step. 0 You can test if the data was properly deleted by going back to menu option #1 to re-display the customer list (or by opening the CSV file). Enter a menu choice: 5 Enter a customer ID: 999 *** Delete Customer *** Customer ID: 999 Last name: Bear Fi rst name : Bobby Are you sure you want to delete (y)? y STATUS: Customer deleted! 7. Copy customer data from BKUP 0 Write a function fortesting purposes only that will copy the backup file to the customers file. In the event that you deleted and updated records, this option will reset the customers.csv file to the original data. This will be really helpful as you are testing all of the menu options. This is the only code that you need for this step: from Wimport We WBKUPJILE, CUST_FILE) 0 BKUP_F|LE and CUST_FILE are global constants defined at the top of your code. Set these string constants to the actual file names. Use these global constants throughout your code. submitting the Assignment I First, review the Assignment Tips & Updates page to see if there are any additional requirements to this assignment denoted with the tag: [required]. 0 To submit the assignment, go to Canvas and open the assignment link, 0 Upload your *.pyfi|e. You may upload more than once as long as it is before the due date 81 time. Only the final submission will be graded. 0 Note: You will only submit your program since your code will allow us to create a new file and add records. Do not upload any csv files, 1297 words I331 ,0 Type here to search

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions