Question: DCIT50 Assignment Instructions: 1. Write a Python program for each of the problems below. 2. Save all the Python programs to a text file (example,
DCIT50 Assignment Instructions: 1. Write a Python program for each of the problems below. 2. Save all the Python programs to a text file (example, myAnswers.py). 4. Deadline is Jan. 16, 2022, Sunday 5 PM. Problems: A. Manually create a text file named studs_grades.txt and store the text below, which is a list of students, their section, and their grades. The first row is the column headings for the data which is separated by semi-colon. STUDENT;SECTION;GRADE Abordo;BSIT4A;2.25 Agustin;BSIT4A;1.75 Asiatico;BSIT4A;3.00 Asilo;BSIT4A;2.75 Bernabe;BSIT4A;2.25 Borja;BSIT4A;2.00 Botabara;BSIT4A;3.00 Cagoco;BSIT4A;3.00 Cario;BSIT4A;3.00 Cruz;BSIT4A;3.00 Dapatnapo;BSIT4A;3.00 Darupan;BSIT4A;2.25 Delos Reyes;BSIT4A;3.00 Ono;BSIT4A;3.00 Torres;BSIT4A;2.50 Ugale;BSIT4A;2.25 Elpedes;BSIT4B;3.00 Endozo;BSIT4B;2.50 Estrada;BSIT4B;3.00 Evangelista;BSIT4B;2.75 Fernandez;BSIT4B;3.00 Flores;BSIT4B;3.00 Gayeta;BSIT4B;2.25 Gernale;BSIT4B;2.25 Guarino;BSIT4B;2.50 Lecaros;BSIT4B;3.00 Legarda;BSIT4B;2.50 Longcop;BSIT4B;2.75 Mabansag;BSIT4B;2.75 Malaluan;BSIT4B;2.50 Manaba;BSIT4B;2.25 Manarin;BSIT4B;3.00 Mengol;BSIT4B;3.00 Opriasa;BSIT4B;2.50 Pangan;BSIT4B;1.75 Cortez;BSIT4C;3.00 Pantilag;BSIT4C;2.25 Penuliar;BSIT4C;3.00 Relojo;BSIT4C;3.00 Reyes;BSIT4C;2.75 Salazar;BSIT4C;3.00 Santiago;BSIT4C;2.25 Seberre;BSIT4C;3.00 Suayan;BSIT4C;3.00 Sulit;BSIT4C;3.00 Tejada;BSIT4C;2.50 Tura;BSIT4C;2.25 Tuvieron;BSIT4C;1.75 Vicente;BSIT4C;2.25 Yacub;BSIT4C;2.75 B. Next, define a class named StudentGrades . The class constructor requires a string argument which is the file studs_grades.txt and read the data and store it in an instance variable named studs_dict with the data structure as shown below: {'STUDENT': ['Abordo', 'Agustin', ...], 'SECTION': ['BSIT4A', 'BSIT4A', ...], 'GRADE': [2.25, 1.75, ...] } C. Next, modify the class StudentGrades and add an instance method named print_grades_count , to print a formatted display of the number of students per grade, in ascending order of grades, as shown below: Grade Student Count ----- ------------- 1.75 3 2.00 1 2.25 11 2.50 7 2.75 6 3.00 22 D. Next, modify the class StudentGrades and add an instance method named list_students(self, param_data) that requires a param_data as argument. The method will be used later to make a formatted display of a list of students (sorted alphabetically), with their section and grade, as illustrated below: Student Section Grade --------------- ---------- ------- Evangelista BSIT4B 2.75 Gayeta BSIT4B 2.25 Gernale BSIT4B 2.25 Guarino BSIT4B 2.50 ... ... ... E. Next, modify the class StudentGrades and add an instance method named print_grades_above_two that uses the items of studs_dict and the method list_students to display the alphabetical list of students with grades higher than 2.0 (it means, between 1.0 and 1.75), as shown in sample below: Student Section Grade --------------- ---------- ------- Agustin BSIT4A 1.75 Pangan BSIT4B 1.75 ... ... ... F. Next, modify the class StudentGrades and add an instance method named print_grades_below_two that uses the items of studs_dict and the method list_students to display the alphabetical list of students with grades between 2.00 and 2.75 (include 2.00 and 2.75), as shown in sample below: Student Section Grade --------------- ---------- ------- Abordo BSIT4A 2.25 Asilo BSIT4A 2.75 Bernabe BSIT4A 2.25 ... ... ... Vicente BSIT4C 2.25 Yacub BSIT4C 2.75 G. Next, modify the class StudentGrades and add an instance method named print_grades_equal_three that uses the items of studs_dict and the method list_students to display the alphabetical list of students with grades equal to 3.0, as shown in sample below: Student Section Grade --------------- ---------- ------- Asiatico BSIT4A 3.00 Botabara BSIT4A 3.00 Cagoco BSIT4A 3.00 ... ... ... Suayan BSIT4C 3.00 Sulit BSIT4C 3.00 H. Finally, modify the class StudentGrades and add an instance method named print_grades_of_bsit4a that uses the items of studs_dict and the method list_students to display the alphabetical list of students who belong to BSIT4A, as shown in sample below: Student Section Grade --------------- ---------- ------- Abordo BSIT4A 2.25 Agustin BSIT4A 1.75 Asiatico BSIT4A 3.00 ... ... ... Torres BSIT4A 2.50 Ugale BSIT4A 2.25 I. Create an object named sg_obj of the class StudentGrades and call the print... methods, as shown in sample below: sg_obj = StudentGrades('studs_grades.txt') sg_obj.print_grades_count() sg_obj.print_grades_above_two() sg_obj.print_grades_below_two() sg_obj.print_grades_equal_three() sg_obj.print_grades_of_bsit4a()
(Need answers and solutions asap, thank you!)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
