Python create a class called Student Required attributes (all Attributes should be hidden): a class attribute that keep

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Python create a class called Student Required attributes (all Attributes should be hidden): a class attribute that keep

Post by answerhappygod »

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"
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply