Question: Define a class named person with the following data attributes: _ _ name; _ _ feet; _ _ inches; _ _ weight; The attributes represent
Define a class named person with the following data attributes: name; feet; inches; weight; The attributes represent a persons name, height measured in feet and inches and weight measured in pounds. The person class should have an init method that creates these attributes. It should also have the following methods: input: Prompts the user for name, feet, inches and weight and sets the private data values to the user entered values. Checks for negative values for feet, inches, and weight and for inches greater than If any of these error conditions occurs, an error message should be displayed, and no values should be set. grow: Increases the persons height by the given number of inches. Feet and inches should be correctly set based on the increase. If the given number of inches is negative, an error message should be displayed, and the values not changed. shrink: Decreases the persons height by the given number of inches. Feet and inches should be correctly set based on the decrease. If the given number of inches is negative, an error message should be displayed, and the values not changed. If the decrease in inches gives a total height value less than inch, an error message should be displayed and the values not changed. gain: Increases the persons weight by the given weight. If the given weight is negative, an error message should be displayed, and the values not changed. lose: Decreases the persons weight by the given weight. If the given weight is negative, an error message should be displayed, and the values not changed. If the decrease in weight gives a total weight value less than pound, an error message should be printed and the values not changed. display: Outputs the name, height and weight with labels and userfriendly formatting. It also computes and displays the persons body mass index, BMI. The formula for this is: BMI weight inchesNote: this is total height in inches squared The BMI should be printed with two places after the decimal. See the example for the format the output should follow. Write a Python application program that utilizes the person object. Be sure it imports the person module. It should be menu driven with choices for inputting a persons statistics, growing, shrinking, gaining weight, losing weight, displaying the persons statistics and quitting. Your program should follow the formatting given by the following example input shown in bold Note: there are several choices and error conditions not shown in this example. You should test all of these before submitting your program. Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: p Name: UnassignedHeight: feet, inchesWeight: poundsBMI: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: e Enter name: Michael Enter height Feet: Inches: Weight: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: p Height: feet, inchesWeight: poundsBMI: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: g Enter a number of inches to grow: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: s Enter a number of inches to shrink: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: l Illegal data entry, please try again! Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: d Enter a number of pounds to lose: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: p Name: MichaelHeight: feet, inchesWeight: poundsBMI: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: i Enter a number of pounds to gain: Number of pounds to gain must be positive! Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: e Enter name: DianeEnter height Feet: Inches: Weight: Illegal data entry! You'll need to try again! Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: p Name: MichaelHeight: feet, inchesWeight: poundsBMI: Enter one of the following: e: Enter a persons statistics g: Grow by a number of inches s: Shrink by a number of inches i: Increase in weight d: Decrease in weight p: Display the current statistics q: Quit the program Command: q Thanks! Program Ended.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
