- 1
Can anyone please help me in java
"Time Converter program" 12days have to convert in seconds
17 ответов
+ 10
Bhavesh Sove
How many second in one minute?
How many minutes in one hours?
How many hours in one days?
If you know this then you can solve how many seconds in 24 hours.
If you get seconds of 1 day then you can get of 12 days.
+ 5
Bhavesh Sove
Just read the explanation of that problem which is in yellow colored box .
https://www.sololearn.com/coach/948?ref=app
+ 3
Then use your mathematical knowledge
Hint:
```
x = 60
y = 60x
z = 24y
```
+ 2
searching 'days to seconds conversation formula' in google gives you helpful answer
+ 2
Thanks everyone ❤️
Special thanks to #yashraj
+ 2
It will solve your problem!Use it.
import java.util.Scanner;
public class DaysToSeconds{
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;
System.out.println(days*hours*minutes*seconds);
}
}
+ 2
import java.util.Scanner;
public class MathUnitConversions13 {
public static void main(String[] args) {
long days;
Scanner in = new Scanner(System.in);
System.out.println("Please enter days:");
days = in.nextLong();
long seconds = days * 24 * 60 * 60;
System.out.println(seconds + " Seconds");
}
}
+ 2
First make use of package then make class,then method main then scanner then 👇👇
int days = scanner.nextInt();
int sec=days*24*60*60;
System.out.println(sec);
I am telling you this because earlier I was also weak in programing 😅😅😅😅.
Final code should be 👇👇👇👇
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
int sec=days*24*60*60;
System.out.println(sec);
}
}
+ 1
https://code.sololearn.com/cC3PvsqGrXhw/?ref=app
It may help you Bhavesh Sove
+ 1
+ 1
in one hour there are 84600 seconds, so the algorithm becomes.
Import Java.util.Scanner;
Public class Con sec{
Public static void main(String[] args){
Int day = sc.nextInt();
Int sec = day * 84600;
System.out.print(sec);
}
}
0
I know there are -
24hrs in a day
60min in hour
60sec in min
But I don't know the method for coding in Java I am confused 🙄
0
int num1 = days;
int num2 =num1*24;
int num3 =num2*60;
int num4 =num3*60;
System.out.println(num4);
0
public class Program
{
public static int secondsConvertor(int days){
int sec,mins,hours=24;
mins=60;
sec=60;
return days*hours*mins*sec;};
public static void main(String[] args) {
System.out.print(secondsConvertor(12));
}
}
0
You are most welcome!Bhavesh Sove
0
Got it
0
In this lab, you are going to draw some Ascii Art using a two dimensional array. When dealing with multi-dimensional arrays, you’ll typically use nested loops (i.e. a loop within a loop). The outer loop typically iterates over the rows of the array, while the inner loop typically iterates over the columns.
A two dimensional array uses two indexes. The first index represents the row number, while the second index represents the column. For example: myArray[0][1] refers to the first row (0) and the second column (1).
Can someone help me with this problem?