|
|
How do I write a program to compute the ideal weight for either male or female. 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 input his/her gender by typing 1 for male and 2 for female. Then the user will enter how many inches they are over 5ft. It should then compute and print either the ideal weight for a female or the ideal weight for a male. I really don't know how I'm supposed to do this, and I really wish I had a computer science genius to help me or show me how to do this, if anyone can help, PLEASE PLEASE HELP ME!!! THANK YOU!
I've done this soo far:
import java.io.*;
import java.text.NumberFormat;
public class idealWeight
{
public static void main (String [] args) throws IOException{
// Constants
BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
String type
String feet
String inches
String idealWeight
String baseWeight
String pounds
int typeParsed = { male: 1, female: 2};
int feetParsed;
int inchesParsed;
int idealWeightParsed;
int[] baseWeightParsed = {100,106};
int[] poundsParsed = {5,6};
// Request the inputs
System.out.print ("Enter weight: ");
baseWeight = input.readLine();
baseWeightParsed = integer.parseInt (baseWeight);
System.out.print ("Enter the feet, inches: ");
feetParsed = input.readLine();
feetParsed = Integer.parseInt (feet);
System.out.print ("Enter the inches:");
inchesParsed = input.readLine ();
inchesParsed = Integer. parseInt (inches);
idealWeightParsed = baseWeightParsed * feetParsed + inchesParsed;
if{
(feetParsed > 5) inchesParsed += (feetParsed-5)*12;
idealWeightParsed = baseWeightParsed[typeParsed] + (inchesParsed * poundsParsed[typeParsed]);
}