+ 1

Time Converter

Need more explanation with the time converter You need a program to convert days to seconds. The given code takes the amount of days as input. Complete the code to convert it to seconds and output the result. Sample Input: 12 Sample Output: 1036800 Explanation: 12 days are 12*24 = 288 hours, which are 288*60 = 17280 minutes, which are 17280*60 = 1036800 seconds. 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 what method do I put above the text? } } Thank you for the support!

11th Dec 2021, 6:02 AM
peter
4 Answers
+ 1
peter import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.print("Enter a day? "); int Day=sc.nextInt(); //your code goes here int hours=24*Day; int minutes=hours*60; int seconds=minutes*60; System.out.println(seconds); } }
28th May 2022, 2:01 AM
Sonam
Sonam - avatar
0
int hours = days * 24; This should give you the pattern to follow. In the end you can print the result like so: System.out.println(seconds);
11th Dec 2021, 6:28 AM
Tibor Santa
Tibor Santa - avatar
0
System.out.println(seconds); its telling me to put " " inside the (seconds);
11th Dec 2021, 6:33 AM
peter
- 3
Can you unblock my I'd please
30th May 2022, 2:50 PM
Gundeboina Vinod