197k views
4 votes
write a public static method named meterstofeetandinches that will take a single argument of type double and will return a string. when called, and passed a distance value (in meters), this method must compute and return a string value with the equivalent distance in feet and inches.

1 Answer

2 votes
public static String meterstofeetandinches(double meters) {
double feet = meters * 3.28084;
double inches = feet * 12;
return String.format("%.2f meters is equivalent to %.2f feet and %.2f inches.", meters, feet, inches);
}
User Sejn
by
7.4k points