Feet to Inches Converter | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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
8 Respostas
+ 2
Sololearn's code playground input process is different ,if you are facing issue with it execute the below code and go through the steps below https://sololearn.com/compiler-playground/WhiNb9BkJUVC/?ref=app
25th Feb 2024, 7:12 PM
š˜•š˜‰
š˜•š˜‰ - avatar
+ 1
Hi Niranjan Pendli Show us your attempt first by attaching your code .
25th Feb 2024, 5:06 PM
š˜•š˜‰
š˜•š˜‰ - avatar
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
Code seems to working fine. Is there any issue you are facing ?
25th Feb 2024, 5:36 PM
š˜•š˜‰
š˜•š˜‰ - avatar
0
Sololearn compiler is not taking šŸ˜
25th Feb 2024, 6:42 PM
Niranjan
Niranjan - avatar
25th Feb 2024, 7:04 PM
š˜•š˜‰
š˜•š˜‰ - 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