Question: Complete the following code in order to calculate the height of a person in meters, given that his/her height is heightInInches inches. Assume that the

Complete the following code in order to calculate the height of a person in meters, given that his/her height is heightInInches inches. Assume that the initial value of variable heightInInches is already set to a positive integer. You need to convert the given heightInInches to meters. Use the conversion rate 0.0254 as your inches to meters conversion rate. For example, 1 inch is 0.0254 meters. Define a variable called heightInMeters and set the height in meters value to this variable. Try to solve this problem by defining constant values (use keyword final) that will store the conversion rate specified above. Then, use these constant values in your calculations. (This is not a requirement but something that will make the code readability better)

E.g. 1: If the value of heightInInches is 63, the code prints "Height in meters: 1.6002" (without the quotations). Please pay attention to the white spaces! E.g. 2: If the value of heightInInches is 75, the code prints "Height in meters: 1.905" (without the quotations). Please pay attention to the white spaces!

// IMPORTANT: YOU DO NOT HAVE TO DEFINE THE MAIN CLASS. Directly write your answer here // Set the height in meters value to a variable called heightInMeters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!