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

25th Feb 2024, 4:02 PM
Niranjan
Niranjan - avatar
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."); } }
25th Feb 2024, 5:29 PM
Niranjan
Niranjan - avatar
0
Sololearn compiler is not taking 😏
25th Feb 2024, 6:42 PM
Niranjan
Niranjan - avatar
0
i run it, it's OK
25th Feb 2024, 7:16 PM
Raak
Raak - avatar
0
Svp c'est possible de bien m'expliquer la programmation
27th Feb 2024, 12:56 PM
Ghislain Sanou
Ghislain Sanou - avatar