Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ideal Weight Write a program to compute the ideal weight for both males and females. According to one study, the ideal weight for a female

Ideal Weight Write a program to compute the ideal weight for both males and females. According to one study, the ideal weight for a female is 100 pounds plus 5 pounds for each inch in height over 5 feet. For example, the ideal weight for a female who is 5'3" would be 100 + 15 = 115 pounds. For a male the ideal weight is 106 pounds plus 6 pounds for each inch in height over 5 feet. For example, the ideal weight for a male who is 6'2" would be 106 + 14*6 =190 pounds. Your program should ask the user to enter his/her height in feet and inches (both as integersso a person 5'3" would enter the 5 and the 3). It should then compute and print both the ideal weight for a female and the ideal weight for a male. The general outline of your main function would be as follows: Declare your variables (think about what variables you needyou need to input two pieces of information (what?), then you need some variables for your calculations (see the following steps) Get the input (height in feet and inches) from the user Compute the total number of inches of height (convert feet and inches to total inches) Compute the ideal weight for a female and the ideal weight for a male (here you basically convert the "word" description above to assignment statements) Print the answers Plan your program, then type it in, compile and run it. Be sure it gives correct answers. Enhance the Program a Bit The weight program would be a bit nicer if it didn't just give one number as the ideal weight for each sex. Generally a person's weight is okay if it is within about 15% of the ideal. Add to your program so that in addition to its current output it prints an okay range for each sexthe range is from the ideal weight minus 15% to the ideal weight plus 15%. You may do this by introducing new variables and assignment statements OR directly within your print statements.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago