Skip to main content
留学咨询

辅导案例-00AM

By May 15, 2020No Comments

Spring 2020 Computer Science I Maíra Marques Samary PhD Section 2 – M-W-F – 8:00AM – Fulton 250 Section 3 – M-W-F – 9:00AM – Fulton 250 TA’s Office Hours – all at Fulton 160 Hang Yin – Tuesdays and Thursdays 10:30 AM – 11:30 AM – [email protected] Erin Berg – Wednesdays 1:00 PM to 3:00 PM- [email protected] Ann Pan – Mondays 2:15PM – 4:15 PM – [email protected] Phillip Tracy – Tuesday 3:00 PM – 5:00 PM – [email protected] Assignment 5 Due date – 04/01/20 7:00 PM General Instructions Create a folder named HW5_LASTNAME_FIRSTNAME. You will populate the folder with ALL of the .py files you write for this homework. To submit the homework, verify the folder includes all your .py files, compress (zip) the folder then upload to Canvas. Remember to include the following comments at the top of each of your .py files: # author: # assignment: # description: What to submit in Canvas? Make sure all your files are saved in the folder HW5_LASTNAME_FIRSTNAME, then compress (zip) the folder and upload to Canvas. If you encounter any problems in completing the assignment or in the submission process, please don’t hesitate to ask for help. The sooner, the better! Problem Let’s tackle a political question. It is standard political dogma that Democrats “want big government” and that Republicans “create jobs.” Let’s see if data supports the dogma. The official source of employment statistics is the U.S. Bureau of Labor Statistics (http://www.bls.gov/data/#employment ) and we have collected data for private employment and government employment. Our assumption is that if a party is creating jobs, then private employment will increase, and if a party is creating bigger government, then government employment will increase. Your job is to extract that information from the files provided. Specification There are two employment data files provided. Both have comma-separated data. Look at the headings to understand their format. Numerical values are in thousands. • government_employment.txt • private_employment.txt
 There is also a comma-separated file on presidents, their years, and their political party. • presidents.txt
 Since the transition from one term to another occurs partway through January, the last year listed for any president is the same as the first year of the next president. To keep things simple let’s, count January entirely for the incoming president. That is, in the file the last year listed for a president will not count. For example, George W. Bush’s last year is listed as 2009 but he was president for only a few weeks that year so we will not count him as being president in 2009. Also, watch out for the “Jr.” for President Carter when you are reading the file—there is an extra comma. What you have to do: 1. Your program will prompt for the file names. Use exceptions to check that each file was opened without an error. 
 2. All president data can only come from the presidents.txt file, i.e. you cannot code specifics about presidents into your program. We will test your program using a file of that format, but with different entries, for example we may test on a file that has three of the lines of that file. 
 3. As an academic requirement, your program must define and use at least two functions in a meaningful way. (Feel free to use more functions; I did.) 
 4. Calculate and display in columns (see sample below): a) the average monthly private employment for each political party 
 b) the average monthly government employment for each political party 
 c) the private employment of the first month and last month of each president 
 d) the change in private employment from the first month to the last month of each president; 
 Hint: There is a useful formatting type for printing percentage 
 print(“{:6.2%}”.format(1/3)) 
 33.33% 
 There is a useful formatting type that puts commas in numbers (either int or float): 
 print(“{:,}”.format(123456}) 123,456 
 Sample Output (note that we will test on the provided president’s file as well as a subset of the file) report the change as both a difference and as a percentage RUBRIC Excellent (100% of points)) Average (60% of points) Needs Improving (40% of points) Possible Points Function module • Functions are implemented properly • Function headers are complete and accurate • Functions are generally implemented properly, but exhibit minor errors. • Function headers are generally complete and accurate, but some minor details are missing. • Functions are implemented improperly. • Function headers are sketchy or missing. 3 User interface • UI formatting is appropriate. • Prompts are complete and concise. • UI formatting exhibits minor flaws. • UI formatting is sketchy or haphazard. 1 • Information is presented in a meaningful form. • Prompts are not completely clear and concise. • Information presentation is slightly confusing. • Prompts are confusing or missing completely. • Information presentation is completely confusing. Output (file with DNA barcode) Parameters smaller than 20 (sequences) and 4 (size) • File formatting is appropriate. • Information is presented in a meaningful form. • Contains the information as requested • File formatting is not the most appropriate. • It does not contain all information requested • Few of the DNA barcodes does not follow the criteria • File formatting is not appropriate. • It does not contain all information requested • Many of the DNA barcodes does not follow the criteria 3 Output (file with DNA barcode) Parameters bigger than 20 (sequences) and 4 (size) • File formatting is appropriate. • Information is presented in a meaningful form. • Contains the information as requested • File formatting is not the most appropriate. • It does not contain all information requested • Few of the DNA barcodes does not follow the criteria • File formatting is not appropriate. • It does not contain all information requested • Many of the DNA barcodes does not follow the criteria 3 FINAL SCORE 10

admin

Author admin

More posts by admin