Can anyone tell how to fix this? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
19th Mar 2022, 10:03 AM
ganesh annangi
12 Respostas
+ 4
As already mentioned, use days instead of x for the calculation. Remove the 2nd main method and check the brackets {}
19th Mar 2022, 10:50 AM
Lisa
Lisa - avatar
+ 2
In addition to what Ipang suggested: you have 2 main functions in your code, you only need one. And there are an non-matching brackets
19th Mar 2022, 10:43 AM
Lisa
Lisa - avatar
+ 2
You can. Read our suggestions carefully and look at the examples in the course. We told you what to fix. Then show us your updated code if there is still a problem.
19th Mar 2022, 10:57 AM
Lisa
Lisa - avatar
+ 2
// Solution: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int hours= days*24; int min=60*hours; int sec=min*60; System.out.println(sec); } }
2nd Apr 2022, 6:42 AM
JaScript
JaScript - avatar
19th Mar 2022, 10:34 AM
ganesh annangi
+ 1
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); {} int x=2; int hours= x*24; int min=60*hours; int sec=min*60; System.out.println(sec); } } public class test { public static void main (String[] args){ { int y=53; int h=y*24; int m=h*60; int s=m*60; System.out.println(s); } } }
21st Mar 2022, 7:17 AM
Muneeb Shoukat
0
You're supposed to make the calculation by the <days> input. int days = scanner.nextInt(); System.out.println( days * 86400 ); You don't need that class named test below, you can remove it ... And please put the programming language name in the tags (where you wrote 'days') for improved context clarity šŸ‘ https://code.sololearn.com/W3uiji9X28C1/?ref=app
19th Mar 2022, 10:14 AM
Ipang
19th Mar 2022, 10:34 AM
ganesh annangi
0
Lisa can write program for me.. For different inputs.. 3 and 4.. by submitting in the program... I have still confusion
19th Mar 2022, 10:48 AM
ganesh annangi
0
Lisa i can't get it... Can pls write the program pls.
19th Mar 2022, 10:52 AM
ganesh annangi
0
ganesh annangi (01) your scanner is working fine. Mistakes: (01) Remove class test (02) replace x by days, (03) after replacing x by days, you will have double declarations of variable days ( int days = 2), just remove this double declaration. (04) after doing all these things, you will be able to take any input from the user.šŸ‘
19th Mar 2022, 2:13 PM
NonStop CODING
NonStop CODING - avatar
0
replace x by days remove the line x=2 remove class test ///***""**********************/// import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int hours= days*24; int min=60*hours; int sec=min*60; System.out.println(sec); } }
21st Mar 2022, 7:21 AM
NonStop CODING
NonStop CODING - avatar