how to do the Time converter in Java | Sololearn: Learn to code for FREE!

0

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)); } }

1/14/2021 5:37:31 AM

Michael John Lano

23 Answers

New Answer

+3

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);

+2

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); } }

+1

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); } }

+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); } }

0

Days*24*60*60

0

Don't write this statement"put a number". Only print the statement

0

https://www.sololearn.com/coach/948?ref=app try this reference.

0

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.

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

int hours = days * 24; int minutes = hours * 60; int seconds = minutes * 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

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

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); } }

0

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); } }

0

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); System.out.println(days*24*60*60); } } Simple correct answer

-1

I already did that

-1

Okay I update you after I use it

-1