Question: ##python3.code## #comment on the code please class Student: def __init__(self, name, hours, qpoints): self.__name = name self.__hours = hours self.__qpoints = qpoints def getName(self): return

##python3.code##

#comment on the code please

class Student:

def __init__(self, name, hours, qpoints): self.__name = name self.__hours = hours self.__qpoints = qpoints

def getName(self): return self.__name

def getHours(self): return self.__hours

def getQPoints(self): return self.__qpoints

def getGPA(self): return self.__qpoints / self.__hours

The class Student is given to you in student.py. In this class, Students have 3 attributes, their name, the number of credit hours theyve completed, and the quality points theyve accrued based on their grades (4.0 for an A, 3.7 = A-, 3.3 = B+, etc.).

1)Add a new method to the Student class addGrade(self, gradePoint, credits) where gradePoint is a float that represents a grade (4.0 = A, 3.7 = A-, 3.3 = B+, etc.) and credits is an integer representing the number of credit hours for a particular course. The appropriate Student attributes should be updated in this function.

In a separate module, create a Student with 0 credits and 0 quality points. Add a few courses, and print the result of calling getGPA() for that student

Explain why there should not be a setGPA() method in Student. Leave your answer in a comment beneath your header.

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!