python program

[ad_1]
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 ida name structured as lastname, firstname, for example, “smith, john”two exam scores representing a midterm and an finalYour 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 dictionaryCIT101[“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.
 
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”
[ad_2]Source link
 
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”

What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."

"Order a Custom Paper on Similar Assignment! No Plagiarism! Enjoy 20% Discount"