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

Here\'s the assignment: Ideal Weight Write a program to compute the ideal weight

ID: 3639221 • Letter: H

Question

Here's the assignment:

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 integers—so 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 need—you 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.

Explanation / Answer

please rate - thanks

import java.util.*;
public class main
{
public static void main(String [] args)
{int feet,inches,male,female,totinches;
Scanner in=new Scanner(System.in);
System.out.println("Enter your Height in feet and inches");
System.out.print("Enter feet: ");
feet=in.nextInt();
System.out.print("Enter inches: ");
inches=in.nextInt();
totinches=feet*12+inches;
male=106+(totinches-(5*12))*6;
female=100+(totinches-(5*12))*5;
System.out.println("Ideal weights for a person "+feet+"'"+inches+""");
System.out.println("Male: "+male);
System.out.println("Female: "+female);
}
}

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