Question: Python: Write a Student class that stores information for a student. The class should include the following instance variables: o id , an integer identifier

Python: Write a Student class that stores information for a student. The class should include the following instance variables:

o id, an integer identifier for the student

o lastName, a string for the student's last name

o credits, an integer representing the number of course-credits the student has earned

o courseLoad, an integer representing the current number of credits in progress

Write the following methods for your Student class:

o A constructor (__init__) that, given an id, and a name, creates a Student with those values and no course-credits and no course load.

o A registerCurrent method that sets the current course load. The course load must be positive and no greater than 4 credits, otherwise no change happens

o A withdraw method, which decreases the course load by one credit, but never goes below 0.

o A passedCourse method, which removes one course from the current course load and adds to the students overall course-credits.

o A createEmail method, which returns a string. The string should be an email address of the student's name combined with their ID and remainder of @school.edu. For example, a student with last name "Jone", and ID 31 should return "jone31@school.edu"

This is what I have so far

class Student: def __init__(self, i_d, lastName): self.id = i_d self.lastName = lastName self.credits = 0 self.courseLoad = 0

def registerCurrent(self): courseLoad = 3

def withdraw(self): if courseLoad

def passedCourse(self):

def createEmail(self): return self.lastName + self.id + "@school.edu"

student = Student(31, "Jone") print(student.registerCurrent) print(student.withdraw) print(student.passedCourse) print(Studen.createEmail)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!