0
Can anyone tell how to fix this?
Days to seconds https://code.sololearn.com/cDSD5bw0p9db/?ref=app https://code.sololearn.com/cDSD5bw0p9db/?ref=app
12 Respostas
+ 4
As already mentioned, use days instead of x for the calculation. Remove the 2nd main method and check the brackets {}
+ 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
+ 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.
+ 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);
}
}
+ 1
+ 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);
}
}
}
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
0
Lisa can write program for me..
For different inputs.. 3 and 4.. by submitting in the program... I have still confusion
0
Lisa i can't get it... Can pls write the program pls.
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.đ
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);
}
}