Write a code that takes in a person's height in inches and weight in pounds and outputs it in centimeters and kilograms. (1 in = 2.54cm , 1kg = 2.2 lbs.)
Can you help me how to write the code?
Thanks
import java.io.BufferedReader;
import java.io.IOException;
import
java.io.InputStreamReader;
public class Test {
public static
void main(String[] args) throws IOException {
double height=0;
double
weight=0;
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter height:
");
height=Double.parseDouble(br.readLine());
System.out.println("Enter
weight:
");
weight=Double.parseDouble(br.readLine());
height=height*2.54;
weight=weight*2.2;
System.out.println("Height:
"+height);
System.out.println("Weight: "+weight);
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF