0
Feet to Inches Converter
You need to make a method that converts a foot value to inches. 1 foot has 12 inches. Define a convert() method, that takes the foot value as its argument and outputs the inches value. The result must be a double. Can someone please solve this
4 odpowiedzi
0
import java.util.Scanner;
public class Program {
// Method to convert feet to inches
public static double convert(double feet) {
return feet * 12.0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the value in feet: ");
double num = sc.nextDouble();
double inches = convert(num);
System.out.println(num + " feet is equal to " + inches + " inches.");
}
}
0
Sololearn compiler is not taking 😏
0
i run it, it's OK
0
Svp c'est possible de bien m'expliquer la programmation