67 007
Assignments Done
99,2%
Successfully Done
In November 2018

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
Expert's answer
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions