Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Define a class named Student with the following attributes: name, student _ id , and grade. The Student class should also have the following

Instructions:
Define a class named Student with the following attributes: name, student_id, and grade.
The Student class should also have the following methods:
__init__(self, name, student_id, grade): a constructor method that initializes an Student object.
get_summary(self): a method that prints the details of the student in the following format: "Student Niko (ID: 1) a grade of 75.".
Create a class named Course which will manage a list of Student objects. This class should have the following methods:
add_student(self, student): a method that takes a Student object and adds it to the list of students.
remove_student(self, student_id): a method that takes a student_id and removes the corresponding Student object from the list.
get_course_gpa(self): a method that iterates over the list of students, calls the get_summary() method on each Student object, sums up their grades, and calculates the average across all students. The function should print the result in the format The GPA for course IFT 101 is 87.00.
Finally, demonstrate the functionality of these classes by creating some Student objects, adding them to a Course object, removing a student, and showing how the GPA changes.
Remember to follow good OOP principles such as encapsulation and use comments to document your classes and methods.
When your program runs, it should match the expected output below but should be able to properly handle any valid type of input for the various functions used.Student Niko added to course IFT 101.
Student Sarah added to course IFT 101.
Student Alice added to course IFT 101.
Student Niko got a grade of 75.
Student Sarah got a grade of 99.
Student Alice got a grade of 100.
The GPA for course IFT 101 is 91.33.
Student Alice removed from course IFT 101.
Student Niko got a grade of 75.
Student Sarah got a grade of 99.
The GPA for course IFT 101 is 87.00.
image text in transcribed

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions