-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExBasicIO3.java
More file actions
35 lines (29 loc) · 1.41 KB
/
ExBasicIO3.java
File metadata and controls
35 lines (29 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Scanner;
public class ExBasicIO3{
public static void main(String[] args){
Scanner obj = new Scanner(System.in);
int sec = obj.nextInt(); //read the total seconds and print time format Example :hr:min:sec
int hours = sec/(60*60);
sec=sec%(60*60);
int minutes = sec/60;
int seconds = sec%60;
System.out.printf("%02d:HOUR %02d:MIN %02d:SEC",hours,minutes,seconds);
long Day = obj.nextLong(); //calculate number of years,weeks,remaining days for the given total days
long year = Day / 365;
Day = Day % 365;
long week = Day / 7;
long days = Day % 7;
System.out.println("Number of Years:"+year);
System.out.println("Number of Week:"+week);
System.out.println("Number of Days:"+days);
double celsius = obj.nextDouble(); //convert Celsius into Fahrenheit
double fahrenheit = ((celsius * 9) / 5) + 32;
System.out.printf("%.2fF", fahrenheit);
double degree = obj.nextDouble(); //Convert Degree into Radian
double radian = degree * (Math.PI / 180.0);
System.out.printf("%.2f", radian);
double inches = obj.nextDouble(); //Covert Inches into feet
double feet = inches * 0.08333;
System.out.printf("%.2f", feet);
}
}