package com.codegym.task.task01.task0131;
/*
More conversions
*/
public class Solution {
public static void main(String[] args) {
System.out.println(getFeetFromInches(28));
}
public static int getFeetFromInches(int inches) {
//write your code here
// int fet = Math.round(0.8333);
double Feet = 0.83 * inches;
int Fet = (int) Math.round(Feet);
return Fet;
}
}
error in return type int
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Robert P
24 October 2018, 04:36
You are making this harder that it needs to be.
In the imperial measurement system, there are 12 inches per foot (plural feet)
No conversion to decimal is needed, Java can do the work for you.
!!! The condition asks for whole feet only. There is no need for <double>
Example: 37 inches converted to feet according to the condition would be 3 feet.
Example: 14 inches converted would be 1 foot.
Example: 26 inches would be 2 feet.
Ignore the remainder.
+2
Jaisingh
24 October 2018, 02:21
1/12 = 0.0833 ... i guess
so change the conversion value... it will be verified then...!!
0
Michael Martin
23 October 2018, 17:44
Your conversion from inches to feet is incorrect. It is not .83
0