CS 112 - Spring 2022 - Programming Assignment 8 Basic File 1/0 Due Date: Monday April 25, Noon (12 pm) This assignment i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

CS 112 - Spring 2022 - Programming Assignment 8 Basic File 1/0 Due Date: Monday April 25, Noon (12 pm) This assignment i

Post by answerhappygod »

Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 1
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 1 (52.07 KiB) Viewed 34 times
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 2
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 2 (38.26 KiB) Viewed 34 times
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 3
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 3 (54.37 KiB) Viewed 34 times
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 4
Cs 112 Spring 2022 Programming Assignment 8 Basic File 1 0 Due Date Monday April 25 Noon 12 Pm This Assignment I 4 (40.83 KiB) Viewed 34 times
CS 112 - Spring 2022 - Programming Assignment 8 Basic File 1/0 Due Date: Monday April 25, Noon (12 pm) This assignment is an Individual Effort assignment. The Honor Code Applies. The purpose of this assignment is to practico manipulating files in Python. You will be calculating a few different things based on data pertaining to assignment grades. See the assignment basics file for more detailed information about getting assistance. running the test file, grading, commenting, and many other extremely important things. Each assignment is governed by the rules in that document. Needed files: Download the attached file to use the tests we will use when grading your assignment .tester8.py • PABtemplate.py .mason.grades gunston.grades • turing.grades gauss.grades Background The purpose of this assignment is to practice reading and writing text files programatically. Our example task for this is a simple program that can read and store assignment grades to and from text files. This coupled with the grade calculation functions from PAS should give you a useful tool beyond the exercise of practicing with Python General Restrictions Any function which violates any of the following will receive zero points, regardless of the autograder You are not allowed to import anything. . You are not allowed to use anything that hasn't already been covered in class. . You are allowed to use slicing, any string functions, any list functions, and all types of string formatting Pay particular attention to any restrictions written in the task descriptions below. . Make sure you comment your code where appropriate. Testing A template file (PAStemplate.py) is provided which includes the basic outline of the functions you are required to complete. The tester will be calling your functions with different arguments
and checking the return values to decide the correctness of your code. Your functions should not ask for user input and should not print anything When you run your code with the tester or submit your code to Gradescope you can see the results of the tests. Note: if you want to perform your own tests, you do not need to modify the tester. Simply call the functions you've written providing arguments you want to check. Be sure to remove any tests you've added before submitting. Submitting your code: Submit your .py file (correctly named) to Gradescope under Programming Assignment 8 Link to Gradescope is in our Blackboard page under - Programming Assignments submit to Gradescope here Do not forget to name your file netid 2xX PA8.py, where netiD is NOT your G-number but your GMU email ID and 2xx is your lab section number. Do not forget to copy and paste the honor code statement from the Assignment Basics document to the beginning of your submission.py file. . Do not forget to comment your code • No hard coding! Grading. Rubric . 5pts - Correct Submission 5pts - Well-Documented . 40pts - Calculations Correct Total: 50pts Note: If your code does not run (crashes due to errors), it will receive at most 12 points. No exceptions. As stated on our syllabus, turning in running code is essential
Functions The signature of each function is provided below, do not make any changes to them otherwise the tester will not work properly. The following are the functions you must implement: def read_grades_file(filename, project=False): Given a filename, open and read the given file and parse it into a dictionary in the grades format. The text file format should have one line for each value. The order is: • Name • Programming Assignments • Labs • zyBooks Midterm 1 Midterm2 • Final Each line will contain a list of values separated by spaces. The first value on each line will be a string indicating the assignment type of the values that follow. The value for the name will be a string, and loading and trailing spaces should be ignored you may find the string method strip to be useful for this). The value for the mid1","mid", and "final assignment types will always be a single floating point value. All the other assignment types will have one or more floating point values. If the parameter project is False (default), then these grade values should be stored in the returned dictionary as-is. On the other hand, it project is true then you should check for missing grade values. If project is True and there are fewer than 9 programming assignments, 11 labs, or 15 zyBooks, you will need to project values for all of the missing grades (you do not need to consider the case where there are more grades). To do this for a given assignment type, compute the average grade for that assignment type, and then add copies of that average to the end of the given grade values so that that assignment type has the correct number of grades. For example, the file had the following line 'pa, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0", then there are only 7 programming assignment grade values. If project were True, you would compute the average of the given grades ((1.0+2.0-3.0-4.0+5.0+6.0+7.0)/7 = 4.0), and add that to the end of the list of grade values, so that the dictionary's value for the key "pa" would be the list 11.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.6. 4.0. 4.01. Examples: The "mason grades" file included with the tester should look like this: name, George Mason pa, 100.0, 100.0, 95.0. 95.0, 97.0 Lab, 100.0, 100.0, 100.0, 0.0, 100.0 zy, 100.0, 100.0, 100.0, 100.0, 100.0 midi, 90.0 mid2, 80.0 Final, 85.0
this When this file is parsed with project=False, the returned dictionary should look like ('name': 'George Mason 'pa': 1100.0, 100.0, 95.0, 95.0, 97.0), "lab': (100.0, 100.0, 100.0.0.0, 100.0). zyt: 100.0,200.0 100.0, 100.0, 100.0). 'midl': 90.0, mid2': B0.0, final': 85.0) The same file when parsed with project True, the returned dictionary should look like this ('name': 'George Mason', pa : 1100.0, 100.0, 95.0, 95.0, 97.0, 97.4. 97.4, 97.4, 97.4). lab': 1100.0, 100.0, 100.0.0.0, 100.0, 80.0, 80.0, 80.0, 80.0, 80.0, 0.01, **y: 1100... 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 200.0). midl': 90.0, mid2': 80.0 'finall: 85.0) def weite_grades_file(filename, grades): Given a filename and a dictionary in the grades format, write the values in the given dictionary into the given file. The text file format should be the same as what was used in the read grades_file function. Note 1: A good way to check your work on these two functions is to try and read a file you've written and vice versa. Note 2: Make sure not to overwrite any important files like the tester, or the test case files! Examples: Here's a dictionary in the grades format for a student named Alan Turing: I'name': 'Alan Turing'. *pal: (1.0, 0.0, 1.0, 0.0, 1.0). lab: (1.0, 1.0, 1.0, 0.0, 1.0), *zy 10.0.0.0, 1.0.0.0, 1.0). nidi': 1.0, mid2': 0.0, "Final': 1.0) And here is how the output file should look given this input: name, Alan Turing pa, 1.0, 0.0, 1.0, 0.0, 1.0 lab, 1.0, 1.0, 1.0, 0.0, 1.0 zy. 0.0.0.0, 1.0, 0.0, 1.0 midi, 1.0 mid2, 0.0 final. 1.0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply