Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python please problem 2. roblem 2 [14 points ] Calculating student grades. This problem requires you to read data from several files (containing numeric scores

python please
problem 2.
image text in transcribed
image text in transcribed
image text in transcribed
roblem 2 [14 points ] Calculating student grades. This problem requires you to read data from several files (containing numeric scores ou homeworks, quizses, and exams for students in a course), use a dictionary to collect information from the data in those files, and finally to write a combined courge grade roster into an output file. Evaluation criteria for the course are described below: 1. Four homework assiguments are handed out. Each bomework is out of 100 points. The lowest homework acore is dropped, and the remaining three scores determine the final homework score. The homeworks are worth 30% of the final grade. 2. Eight qubses are given in claws. Each quiz is out of 50 points. The lowest and the highest quiz scores are dropped, and the remaining aix scores determine the final quiz score. The quizes are also worth 30% of the final grade. 3. Two comprehensive exams are given. Each exam is out of 200 points. (No exam fonre! are droppedl) The exams are worth 40% of the final grade. The finsl total score is simply the sum of the combined homework score (out of 30), the combined quiz scote (out of 30), and the final exam ncore (out of 40), each caleniated as described above. All gcores are real values. The letter grade is determined according to the nsual senle: A final total score of 90.0 or higher is an A,85.0 or higher is a B+,80.0 or higher is A B, 75.0 or higher is a Ct, 70.0 or higher is a C, 60.0 or higher is A D, and anything lower than 60.0 in an F. Tbe data for this course is available in four separate input files: - A file called "studentids. txt" that contains aimply the liat of identification (ID) numbesn for the atudents in the conne with one entry per student. Facl line of the file - A file called "hwacores, txt" that contrins a dump of all the homework scores for all the ptudents in the courne. Bach line of the file contains aimply an ID followed by a vingle homework soore. A bomework soore is an integer value between 0 and 100 (incluivive). Obeerve that the same ID will, in general, appear on aeveral lines in the file, once for every homesork anbmimion made by the student with that ID. The number of entriew for a stadent is agual to tho number of Lotnework submbegioain male by that ntadent. If A stadeat mbimits finwe thinn 4 homanworks, the measining linaneserk woocen nee simply aro (keep theis in mind when dropplng the lowst noote). Tho IDs may appear in nny onder in she file (in otlier words, yois abouli not aveame that the mage in will aproar conscutively in the file). qua acore. A quk score is an integer value between 0 and 50 (inclasive). As abore, the bame ID may appear aeveral titnes in the file, once for every quin takea by the student with that ID. The number of entries for a student is equal to the number of quiries taken by that stadent. If a atudent takes fewer than 8 quibes, the remnining quin socmel ane zero. A gain, the IDs may appoar in any order in the file. - A file called "examscores. txt" that contains a dump of all the exam scores for all the studente in the course. Bach line of the file contains aimply an ID follonod by a single exam score. Once again, the same ID may appear more than once in the file and the IDs apper in asy order. Your program shiould crente a neatly formatted outpoit file called "graderonter. txe" that contalia one liae of data per student in the format described below: - The firnt line should contaln the colama headings, which ate foID, IN (30),QU1Z(30), EXMM (40), TOTAL(100), GRADE. The width of the first column must be 14 charnetens long. The width of the moond, third, and fourth columns ahould be 10 charactess longe the width of fift colnma sbould be 12 characters long, and the width of the sixth column shonld be 10 characters long. Priat the first columa header kef-justified and the remaining ones right-justified. - The next lise should be a mrrios of byphens (--) (as seen in sumple output file). - 'The rest of the flle should contain one line of iaformation per mtudent. Bach line ahould contain the ID in the first columa (whlth 14), the find horncwork soore out of 30 (width 10), tho final quix soore ont of 30 (width 10), the final excum score out of 40 (wideh 10), the final total neore out of 100 (width 12), and the Inster grade (width 10). 7he RUID mast be left-juatifind, than poores mast be right-jastifird, and the letter grime muat be right juctified an will. Bech noore shonald be printed as a real value with a precidion of 2 . and avernge acoren for the homeworks, quberes, exams, and totalic You are whied to accomplah the abcve task by implenenting the following in the module probleaz. py: 1. A function called croate.dict ienary with four paramitenc dafilenase, bufilennse, qztilenane, abd exandalenane. Thene parunetess are, serpertively, the manes of the files onatainisg Madeat ID, hoesenork acom, quak soorns, and exaen nenen fin the format deectibed above). The funetion alould ogiew and door all accoswry flies thas funceion roturns a dietlionary of ky value pairs in which the kry in the ithickat ID and the vilue is itself e dicthoary contrining the kse "bv", "quiz", and "exan". The vhari moociated with theren lings are liste of length 4,8 , anal 2 coatalaing, toppertively? 2. A function called create_graderoster with two parameters: sdata_dict and outfilename. The first parameter, sdata dict, is a dictionary of the type returned by the above function createddictionary. The second parameter, outfilename, is the name of the output file in which a neatly formatted grade roster will be printed (exactly as described above). The function is responsible for opening and closing the file. 3. So that. 1 may run your program at the command line, include appropriate calls to the above functions by passing the names of the data files you are provided. You should do this in the body of the following if statement: if - name _ m "-main_-": A set of sample inpat files is available on Canvas (these are the files studentids,txt, hwscores.txt, quizscores.txt, and examscores.txt), along with an example of the kind of output file that should be created for that data (this is the file SRgraderoster.txt that was ereated by my Python code for this problem). The output file created by your create-graderoster function should look similar (it's okay if the order of the listing is different, but the numbers/grades should be the same). Feel free to create additional data files to test your functions

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

Step: 3

blur-text-image

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 Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

How can excess spread be a form of credit enhancement?

Answered: 1 week ago

Question

What are the two prerequisites for vulnerability management?

Answered: 1 week ago