Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago