Question: Python only The_grades.txt_ content is below GERO 246 009204304 84 GERO 246 862539403 30 GERO 246 649892603 75 GERO 246 305890997 77 GERO 246 946310649
Python only


The_grades.txt_ content is below
GERO 246 009204304 84 GERO 246 862539403 30 GERO 246 649892603 75 GERO 246 305890997 77 GERO 246 946310649 85 GERO 065 009204304 68 GERO 065 862539403 12 GERO 065 649892603 92 GERO 065 305890997 37 GERO 065 946310649 94 GERO 348 009204304 14 GERO 348 862539403 50 GERO 348 649892603 98 GERO 348 305890997 33 GERO 348 946310649 3 GERO 126 009204304 87 GERO 126 862539403 89 GERO 126 649892603 18 GERO 126 305890997 10 GERO 126 946310649 83 GERO 297 009204304 95 GERO 297 862539403 12 GERO 297 649892603 95 GERO 297 305890997 62 GERO 297 946310649 61 SD 246 009204304 65 SD 246 862539403 47 SD 246 649892603 69 SD 246 305890997 25 SD 246 946310649 59 SD 065 009204304 22 SD 065 862539403 83 SD 065 649892603 36 SD 065 305890997 97 SD 065 946310649 28 SD 348 009204304 44 SD 348 862539403 49 SD 348 649892603 31 SD 348 305890997 71 SD 348 946310649 9 SD 126 009204304 8 SD 126 862539403 45 SD 126 649892603 2 SD 126 305890997 21 SD 126 946310649 63 SD 297 009204304 3 SD 297 862539403 44 SD 297 649892603 40 SD 297 305890997 11 SD 297 946310649 81 GEOG 246 009204304 77 GEOG 246 862539403 5 GEOG 246 649892603 8 GEOG 246 305890997 98 GEOG 246 946310649 37 GEOG 065 009204304 9 GEOG 065 862539403 34 GEOG 065 649892603 95 GEOG 065 305890997 4 GEOG 065 946310649 93 GEOG 348 009204304 37 GEOG 348 862539403 63 GEOG 348 649892603 12 GEOG 348 305890997 39 GEOG 348 946310649 51 GEOG 126 009204304 9 GEOG 126 862539403 90 GEOG 126 649892603 28 GEOG 126 305890997 3 GEOG 126 946310649 21 GEOG 297 009204304 44 GEOG 297 862539403 59 GEOG 297 649892603 23 GEOG 297 305890997 86 GEOG 297 946310649 37 IAT 246 009204304 56 IAT 246 862539403 1 IAT 246 649892603 98 IAT 246 305890997 58 IAT 246 946310649 47 IAT 065 009204304 91 IAT 065 862539403 98 IAT 065 649892603 25 IAT 065 305890997 0 IAT 065 946310649 49 IAT 348 009204304 19 IAT 348 862539403 66 IAT 348 649892603 22 IAT 348 305890997 13 IAT 348 946310649 95 IAT 126 009204304 58 IAT 126 862539403 42 IAT 126 649892603 72 IAT 126 305890997 73 IAT 126 946310649 98 IAT 297 009204304 91 IAT 297 862539403 56 IAT 297 649892603 91 IAT 297 305890997 45 IAT 297 946310649 13 BISC 246 009204304 35 BISC 246 862539403 72 BISC 246 649892603 82 BISC 246 305890997 58 BISC 246 946310649 15 BISC 065 009204304 86 BISC 065 862539403 83 BISC 065 649892603 5 BISC 065 305890997 100 BISC 065 946310649 27 BISC 348 009204304 81 BISC 348 862539403 90 BISC 348 649892603 55 BISC 348 305890997 63 BISC 348 946310649 13 BISC 126 009204304 5 BISC 126 862539403 43 BISC 126 649892603 67 BISC 126 305890997 36 BISC 126 946310649 34 BISC 297 009204304 60 BISC 297 862539403 29 BISC 297 649892603 97 BISC 297 305890997 63 BISC 297 946310649 20
Question 4: iGrade [100 marks] A database management system (DBMS) is a software application for creating and managing databases. A DBMS makes it feasible for end users to create, protect, read, update and delete data in a database. The three most widely used DBMSs are Oracle, MySQL and Microsoft SQL server. In this part of the assignment, you as a programmer are supposed to help a university student services to organize courses and students' grades. Imagine the DBMS that handles the university's course management system has crashed, and you are asked to develop a program called, iGrade, to help the school temporarily manage the students' grades. Program Input. You will be given a text file, called grades.txt, containing the grades of different students who took different courses from different departments. Each line of the given file includes four pieces of information: department, course number, student number and grade, which are separated by a space. - Department is a string. - Course number is a 3-digit integer. - Student number is a 9-digit integer. - Grade is an integer between 0 and 100 . Below is an example content of the file "grades.txt": CMPT120926456789100ECON10342345338982BUS21753475548179 Program Tasks. iGrade is capable of running three tasks: 1) computing the average grade of students in a specific course, 2) the GPA of a specific student in their courses, and 3) the number of failed students in a specific course. iGrade receives four types of commands as follows: 1. avg. The avg command asks for the average grades of a specific course. For this command, the user command's format is as follows: avg department Course_number - iGrade should process the given text file, compute the average grade of all students who took the course defined in the command, and print it out. - You should print the result with exactly two decimal points. To do so, you should use the statement: print("\{:.2f\}". format(average)), where 'average' is the result of your computation. For example, if the average is 67.346, it will be rounded to 67.35. If it's 67.344, it will be rounded to 67.34. - The program assumes the user doesn't ask for a course that doesn't exist in the text file. 2. gpa. The gpa command asks to compute the GPA of a specific student given by the user. For this task, the user command's format is as follows: gpa Student_number - Your program should retrieve the grades of the given student and print the average of the student's grades. - You should print the number with exactly two decimal points. To do so, you should use: print(" {:.2f}" ". format (qpas)), where 'qpas' is the result of your computation. - The program assumes the user doesn't ask for a student that doesn't exist in the text file. 3. fails. The fails command asks for the number of failed students of a specific course. Grades strictly less than 75 counts as fails. For this command, the user command's format is as follows: fails department Course_number - Your program should process the given text file, and count the number of failed students of the course defined in the command, and print it. - The program assumes the user doesn't ask for a course that doesn't exist in the text file. 4. quit. The program continues to get new commands from the user until the user enters the command 'quit'. You should assume that the text file grades.txt is in the same directory of your code. You will be provided an example test file (Canvas Assignments) but your program should be able to handle other files having the same format and running commands defined here. Table 4 shows an example output of iGrade on the provided test file. First asks for the average grades of students who took course 065 in the IAT department. Based on the data in the grades file, the answer for this command is 52.6 but print it as 52.60 to have exactly two decimal points. The next command is to find out the gpa of a student with student number 009204304 . Their gpa was 49.92 as printed in the output. The last command is to find out the number of failed students enrolled in course 246 in the GERO department. As the results show only one student had a score strictly less than 75 in this course. Example two follows the same process but the program ends when it receives the command 'quit'. Note that iGrade is case-sensitive, meaning that it differentiates between lowercase and uppercase letters. You can use the modules introduced during the semester to solve the problem. Your program input and output format should be exactly the same as the format of the examples shown in Table 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
