Python
create a class called Student
Required attributes (all Attributes should be hidden):
a class attribute that keeps track of the total instantiations (initial value of 0, and is an integer)
an instance attribute that keeps track of the last name of the student
an instance attribute that keeps track of the first name of the student
Required methods:
the init method, which should set the last name, the first name, and add 1 to the total (class attribute)
the last name should be the first argument , and the first name is the second argument to the constructor call
a method to get the name of the student called getName(), it should return the first and last name
a method to get the total number of instantiations called getStudentCount(), it returns the count
the __str__ method, which should return a string that has the first and last name of the student and the count of all
students, something like "The student's name is Tim Smith, and there are 40 students right now"
Python create a class called Student Required attributes (all Attributes should be hidden): a class attribute that keep
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am