StudentCourse Python

Here is a skeleton for a class representing a student. Complete the Student class by filling in the methods. A student has four properties — his/her name (a string), year (an integer, where 1=freshman, 2=sophomore, 3=junior, 4=senior), major (a string), and courses (a list of Courses). These fields must be private (i.e. not accessible outside the class except via the functions you’ll write). The Course class is provided and you should not change it, however you will need to call some Course methods from within the Student class. In addition to __init__, you’ll also need to complete the following four methods:a.) numCourses – takes no parameters and returns the number of courses the student is taking
b.) isUpperClassman – which takes no parameters and returns a boolean value indicating whether the student is an upperclassman (juniors and seniors are upperclassman)
c.) totalHours – takes no parameters and returns the total number of credit hours the student is taking
d.) _str_ – takes no parameters and returns a string representation of the studentSample Run:s = Student(‘Candice’, 1, ‘Chemistry’, [Course(‘CH 301’, ‘Laude’, 3), Course(‘CS 303E’, ‘Young’, 3), Course(‘UGS 303’, ‘Murry’, 3), Course(‘M 408C’, ‘Davis’, 4), Course(‘GOV 310L’, ‘Moser’, 3)])
s.isUpperClassman() -> False
s.numCourses() -> 5Sample Run:s = Student(‘Candice’, 1, ‘Chemistry’, [Course(‘CH 301’, ‘Laude’, 3), Course(‘CS 303E’, ‘Young’, 3), Course(‘UGS 303’, ‘Murry’, 3), Course(‘M 408C’, ‘Davis’, 4), Course(‘GOV 310L’, ‘Moser’, 3)])
s.totalHours() -> 16Sample Run:s = Student(‘Candice’, 1, ‘Chemistry’, [Course(‘CH 301’, ‘Laude’, 3), Course(‘CS 303E’, ‘Young’, 3), Course(‘UGS 303’, ‘Murry’, 3), Course(‘M 408C’, ‘Davis’, 4), Course(‘GOV 310L’, ‘Moser’, 3)])
str(s) -> ‘Candice is a freshman Chemistry major.’

×
New Download