- 7
how to do the Time converter in Java
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days; int hours = 60; int mins=60; //help me fix this System.out.println("Results : "); days=scanner.nextInt(); System.out.println(""+(days*24*hours*mins)); } }
33 Respuestas
+ 40
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int hours = 24, minutes = 60, seconds = 60;
int days = scanner.nextInt();
System.out.println(days * hours * minutes * seconds);
}
}
+ 9
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
//your code goes here
System.out.println (days*24*60*60);
}
}
+ 4
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//your code goes here
int days = scanner.nextInt();
int hours = days * 24;
int minutes = hours * 60;
int seconds = minutes * 60;
System.out.println(seconds);
}
}
+ 3
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 = 24;
int minutes = 60;
int seconds = 60;
int result = days * hours * minutes * seconds;
System.out.println(result);
}
}
+ 2
Michael John Lano
Its failing because you are using the println function instead of just print. The ln creates an extra line that the solution check doesn’t like.
Use:
System.out.print(days*24*60*60);
+ 1
mport java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days=24;
int hours = 60;
int mins=60;
int res=days*hours*mins;
System.out.println(res);
}}
//simple.
+ 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 hours = days*24;
int minute = hours*60;
int seconds = minute*60;
System.out.println (seconds);
}
}
+ 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 hours = days * 24;
int min = hours * 60;
int sec = min * 60;
System.out.print(sec);
//you should use print instead of printIn
}
}
0
Days*24*60*60
0
I cannot get it right either
0
This is real full 1000% working code try this and follow me please.
import java.util.Scanner; public class DayToSecondsConversion { public static void main(String[] args) { long days; Scanner in = new Scanner(System.in);
days = in.nextLong(); long seconds = days * 24 * 60 * 60; System.out.println(seconds); } }
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
//your code goes here
System.out.println(days*24*60*60);
}
}
0
Thanks
0
this is the correct answer
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int hours = 24, minutes = 60, seconds = 60;
int days = scanner.nextInt();
System.out.println(days * hours * minutes * seconds);
}
}
if this code didn't work please call me on this number 9345563944
0
No logro hacer Que me imprima los 3 resultados a la vez y no me deja pasar , me los imprime siempre en el primer Test , como soluciono eso
I can not make him print the 3 results at the same time and he does not let me pass, he always prints them in the first test, how do I solve that
0
int day = days*24*60*60;
System.out.println(day);
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
//your code goes here
System.out.println(days*24*60*60);
}
}
0
If anyone is looking for the right answer here, scroll to the comment by Viviane Ehwein. I tried every possible combination with different formats and subtle tweaks, but that is the one that works. Thank you.
0
I came back to add that this works too. You don't need to include an extra line of int results since you can place the equation directly in the output line. Play around with the format a bit, there seems to be at least a couple of different acceptable answers that achieve the same answer.
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
//your code goes here
int hours = 24;
int minutes = 60;
int seconds = 60;
System.out.println(days * hours * minutes * seconds);
}
}
0
Still not working have tried it