Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.students.txt(available from Canvas) Provides information about each student Each line has the format: CWIDtNametMajor (where t is the character) 2.instructors.txt(available from Canvas) Provides information about

1.students.txt(available from Canvas)

  • Provides information about each student
  • Each line has the format: CWID\tName\tMajor (where \t is the character)

2.instructors.txt(available from Canvas)

  • Provides information about eachinstructor
  • Each line has the format: CWID\tName\tDepartment (where \t is the character)

3.grades.txt(available from Canvas)

  • Specifies the student CWID, course, and grade for that course, and the instructor CWID
  • Each line has the format: Student CWID\tCourse\tLetterGrade\tInstructor CWID

Your assignment is to read the data from each of the three files and store it in a data structure that is easy to process to meet the following requirements:

  • Your solution should allow a single program to create repositories for different sets of data files, e.g. one set of files for Stevens, another for Columbia University, and a third for xxx.Each university will have different directories of data files.Hint: you should define a class to hold all of the information for a specific university.
  • You may hardcode the names of each of the required "students.txt", "instructors.txt", and "grades.txt" files.Your solution should accept the directory path where the three data files exist so you can easily create multiple sets of input files for testing.
  • Use your file reader generator to readthe students, instructors, and grades files into appropriate data structures or classes.
  • Use PrettyTable to generate and print a summary table of all of the students with their CWID, name, and asortedlist of the courses they've taken (as specified in the grades.txt file).
  • Use PrettyTable to generate and print a summary table of each of the instructors who taught at least one course with their CWID, name, department, the course they've taught, and the number of students in each class.
  • Implement automated tests to verify that the data in the prettytables matches the data from the input data files.

Hints:

  • classRepositoryto hold the students, instructors and grades for a single University.The class is just a container to store all of the data structures together in a single place.
  • classStudentto hold all of the details of a student, including a defaultdict(str) to store the classes taken and the grade where the course is the key and the grade is the value.
  • classInstructorto hold all of the details of an instructor, including a defaultdict(int) to store the names of the courses taught along withthe number of students
  • Read grades fileand either store the data in a list, or just process each line as you read it from the file to update the courses taken by each student and to update the courses taught by each instructor and update the number of students
  • a main() routine to run the whole thing
  • a test suite that compares known values for a directory of student, instructor, and grades files to the computed values.
  • For each student, you need to know the student's name and major.We'll be adding other student attributes in the future, e.g. email address, etc. so a flexible solution will help longer term.
  • The key to your dictionary should uniquely identify the item, e.g. using the student's name as the key is not a good choice because two students may have the same name.
  • Think about how you need to access the data when choosing the keys and values for each of the dictionaries.Recall that the value may be a dictionary, set, list, etc.

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

Students also viewed these Programming questions