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
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");
}
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:
Similar questions