- 2

Hi guys

I don't know what is wrong with my coding I need help

8th Jul 2021, 4:43 PM
Mohammed
6 odpowiedzi
+ 5
You might want to show your code as well, so that we can take a look at what is wrong.
8th Jul 2021, 4:46 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
You were declaring days, hours, etc in String on the second line in main, probably don't need that. You also don't need to assign 12 to days, since you were taking input and storing that into days already. Your result variable lacks a name and on your print statement, you are printing a raw string. Minutes probably shouldn't be 17280 (you only have 60 minutes in an hour)...
9th Jul 2021, 3:13 AM
Hatsy Rei
Hatsy Rei - avatar
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(); String days,hours,minutes,seconds; int days =12; int hours =24; int minutes =17280; int seconds =60; int =("days*hours*minutes*seconds"); System.out.println("seconds"); } }
8th Jul 2021, 6:53 PM
Mohammed
0
The question is 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
8th Jul 2021, 6:54 PM
Mohammed
0
Explanation: 12 days are 12*24 = 288 hours, which are 288*60 = 17280 minutes, which are 17280*60 = 1036800 seconds.
12th Jul 2021, 1:45 AM
Mohammed
0
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
12th Jul 2021, 1:46 AM
Mohammed