Answer:
public static double convertToInches(double numFeet, double numInches){
return (numFeet*12)+numInches;
}
Explanation:
This technique of having more than one method/function having the same name but with different parameter list is called method overloading. When the method is called, the compiler differentiates between them by the supplied parameters. The complete program is given below
public class FunctionOverloadToInches {
public static void main(String[] args) {
double totInches = 0.0;
totInches = convertToInches(4.0, 6.0);
System.out.println("4.0, 6.0 yields " + totInches);
totInches = convertToInches(5.9);
System.out.println("5.9 yields " + totInches);
return;
}
public static double convertToInches(double numFeet)
{
return numFeet * 12.0;
}
/* Your solution goes here */
public static double convertToInches(double numFeet, double numInches){
return (numFeet*12)+numInches;
}
}