Computer Science, asked by bhan61, 1 year ago

Write a method Met that takes as input an integer height.
height contains the height of a person in cm (centimetres).

You have to print the height of this person in ft (feet) and inches.

Take 1 cm = 0.0328 ft and 1 ft = 12 inches

Only write the method - assume that the Class & main method have been defined.

Example Input: 101
Example Output: 3 3
Example Input: 186
Example Output: 6 1
Example Input: 165
Example Output: 5 4


bhan61: can anyone give me reply

Answers

Answered by nitish8089
1
public static void met(int height){

int height_feet=(int)(0.0328*height);

System.out.println("Person height in feet: "+ height_feet+" ft");

int height_inches=(int)(height*0.0328*12)-(height_feet*12);

System.out.println("Person height in inches: "+ height_inches+" inches");

}
Attachments:

nitish8089: but it's not correct.. if you want round-off value then... i will cast it..
bhan61: plz doit
nitish8089: done try to check your input so wait 1 minute..
nitish8089: wait some more time ... if you can ....
bhan61: ok I will wait
nitish8089: now you can check , i am corrected code according your question.....
bhan61: Thank you
bhan61: can you answer my remaining questions
nitish8089: ya!! but some time later...
bhan61: hmmm ok
Similar questions