In: Computer Science
Class AssignmentResult
An object that represents the result of an assignment.
__init__(self, id:int, assignment: Assignment, grade: float): """ This will contain the ID of the student, the assignment that the student worked on and the grade the student received on the assignment. :param id: The ID of the student that created this Assignment result :param assignment: The Assignment that the student worked on. :param grade: A number between 0-1 representing the numerical grade the student received """
id(self) -> int: """ Returns the ID of the student as specified in the constructor. :return: The student's ID """
grade(self) -> float: """ Returns the grade as specified in the constructor. :return: The grade the student received for this assignment """
assignment(self) -> Assignment: """ Returns the assignment as specified in the constructor. :return: The assignment that the student worked on to create this result """
This problem should be executed with Python.
Program Code Screenshot:
The screenshots are attached below for reference.
Please follow them for proper indentation.
Program to copy:
class AssignmentResult:
def __init__(self,id,assignment,grade):#construcor of class
self.assignment_id=id
self.a_assignment=assignment
self.assignment_grade=grade
def id(self):#getter methods for id,assignment,grade
parameters
return self.assignment_id
def grade(self):
return self.assignment_grade
def assignment(self):
return self.a_assignment
Note:
Please let me know in case of any help needed in the comments section. Thank you.