Question: Create a Student class with four instance attributes: stu _ number as an int, name as a string, major as a string and GPA as

Create a Student class with four instance attributes: stu_number as an int, name as a string, major as a string and GPA as an float. The class should include an __init__() method to initialize a Student object and a __str__() method to describe an initialized student object. The class should include two instance methods: one called update_major(), which takes a string as an argument and updates the employee's department attribute; and one called update_GPA(), which takes a float as an argument and updates the Student GPA attribute.
After the Student class code, prompt the user to enter the stu_number, name, major and GPA. Instantiate an Student object by passing in the user's input as the arguments and print out the Student's attributes by calling the __str__() method. No prompting for input should be included in the Student class.
Test the update_major() and update_GPA() methods by calling both methods and passing in a new major and GPA for the Student object that you created. Call the __str__() to display the updated Student object information.

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 Programming Questions!