+ 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!
4 odpowiedzi
+ 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);
}
}
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);
0
System.out.println(seconds);
its telling me to put " " inside the (seconds);
- 3
Can you unblock my I'd please