Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Code has been written to give each attribute its own accessor and mutator. i.

ID: 3917860 • Letter: A

Question

a. Code has been written to give each attribute its own accessor and mutator.

i. Add a protected variable called _gender (Decide how you want to specify Male or Female.)

ii. Write an accessor and mutator for _gender.

iii. Inside demo1(), specify Monty is male, and print that out.

b. i. Add a protected variable called _height, which will be a list! So, for example, [5, 10] will denote a person of height 5 foot ten.

ii. Write an accessor and mutator for _height. def __init__(self): # All variables are protected self._firstName = "" self._lastName = "" self._numberOfTeeth = 32 # 32 if you still have them all. self._weight = 0 # Weight in pounds 5

iii. In the main method, specify Monty is 5 foot ten, and print that out.

c. i. Add a protected variable called _age which will give the integer age in years. We won't worry about months.

ii. Write an accessor and mutator for _age.

iii. Inside demo1(), specify Monty is 34 years old, and print that out.

code:

Explanation / Answer

Solution:

Sampel Run:

Note: If you liked the solution then please do a thumbs up, in case of any query do comment below.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote