python program classes and pickles

We now have remedies for both of these issues. For this program we will create a bunch of student objects, and we’ll have a dictionary that holds a collection of these student objects. That is, the dictionary will represent a course the students are enrolled in. Using a class will allow us to keep both the student data and the methods that operate on that data together. Collecting the class instances into a dictionary and making use of the pickle module will allow us to store and retrieve our student data without having to do any data conversion.

We might have used a list to contain the student objects, but is this case we will use a dictionary. The key associated with the student object will be the student ID. This allows being able to find a given student directly using their ID, without having to iterate through a loop of students to find the one we want.

So, here’s what we need to do. We’ll use a dictionary to be a container for a given course, CIT101. We will populate that dictionary with instances of a student class.

The class we write to represent a particular student needs to have the following 4 (and only 4) instance variables:

a unique id
a name structured as lastname, firstname, for example, “smith, john”
two exam scores representing a midterm and an final
Your class will also need 3 and only 3 methods. The first method needs to be a constructor to create each student so the user can enter the student ID, name, and 2 exam scores. In addition to the constructor, the class will also need the following 2 methods (and no more).

a helper method to calculate the letter grade for the student based on the average of the exam scores. Use the grading scale used for this class.
a method to return the name, two exam scores, and the letter grade for a student.
Your program will allow adding student instances to the CIT101 dictionary so that the dictionary will hold the information for that course.

Each student instance in the dictionary will use the student ID as a key, and the student object instance associated with that ID will be assigned as the key’s value. Assume the dictionary is called CIT101, and the class is called Student, so calling
    Student(id, name, midterm, final)
creates an instance of the student class. If we were hard-coding all this, it might look like the following.

CIT101 = {}        # create the containing dictionary
# add student instance to CIT101 dictionary
CIT101[“123”] = Student(“123”, “smith, john”, 78, 86)

There is a program very similar in structure to this assignment at the end of the first set of lecture notes on classes. It will be the best guide for getting started on this program.

Your program needs to have a 5-option menu that should look very much like the following. Shown is a sample of entering a new student and then displaying all students and their grades.

program 5 menu

For full credit your menu will need the following 5 options. Each option should call a function that performs the proper task.

Option 1 should call a function to display all the student data for the CIT101 course. The function should display the student’s id, name, midterm and final exam scores, and their letter grade. Use formatting to have everything line up in neat columns for option 1. The letter grade should be calculated by the helper method of the student class.
Option 2 should call a function that allows adding a new student instance to the CIT101 dictionary.
Option 3 should call a function that displays the data, including letter grade, for a particular student’s after entering the student ID for that student.
Option 4 allows for a student to drop the class, so here call a function that deletes a student from the dictionary after entering the id of that student.
the last option pickles the dictionary for future processing.
In order to read the class from the pickle file the file needs to exist first. The example given in the lecture notes offers one solution for this issue.

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational