- 6
How to solve the first java project
Java first project
19 Respostas
0
whaaaaat? where is your code?
0
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
}
}
Time converter : days to seconds
0
I didn't get it😕
0
yeah I know to do it from mathematically but don't understand turn into codes
0
You don't understand. That's normal. But the point is you have to try. Review lessons and try to write some code. Spend maybe 10 or 30 minutes and try to write some lines of code.
0
Int days = ??
0
You already defined the input.
int result =days* X * Y * Z;
System.out.println(result);
That's it!
0
Thank you!
0
Ok...you don't need to think a lot in this if you know the basics of java....
As you know how to convert it mathematically so it's just easy as that....
You do multiplication for converting it from days to seconds same is here apply the multiply operator(*) to convert and than print it....
Please try it to solve your self ones than also if it is wrong than see my code...
I recommend you to try by yourself to learn more.....
My code is:
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);
}
}
Hope so it helps....👍👍
0
Thanks
0
Ok...you don't need to think a lot in this if you know the basics of java....
As you know how to convert it mathematically so it's just easy as that....
You do multiplication for converting it from days to seconds same is here apply the multiply operator(*) to convert and than print it....
Please try it to solve your self ones than also if it is wrong than see my code...
I recommend you to try by yourself to learn more.....
My code is:
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);
}
}
Hope so it helps....👍👍
0
Have tried it like different 59 ways. Believe me I tried. What is the answer? So I can understand why I'm doing something. or everybody in this community are like aaa it's so easy try more
0
My trying for I thing 40 of time
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 = int day(2*24)
int min = int hours(48*60)
int sec = int min
System.out.println(int sec)
//your code goes here
}
}
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 result = days*24*60*60
System.out.println(result)
//your code goes here
}
}
What's wrong??
0
Henry put semicolon in the last two lines
0
Thanks and regards my friend. Always something I miss, but I'm just a noob right now. So thank you again Abhinav Raj. 🙏
- 1
Where's your attempt?
- 1
Tharindu Madusanka why you stopped there?
Complete code..
Find
1 minute = 60 seconds.
1 hour = 60 minutes = 60*60 seconds
1 day = 24 hours. = x?
n days has x*n seconds..
- 1
int X = 24;
int Y = 60;
int Z = 60;
int result = X * Y * Z;
System.out.println(result);
This says wrong