Answer to Question #11968 in Java | JSP | JSF for James

Question #11968
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
1
Expert's answer
2012-07-19T07:38:44-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS