-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathTest.java
More file actions
39 lines (32 loc) · 877 Bytes
/
Test.java
File metadata and controls
39 lines (32 loc) · 877 Bytes
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
36
37
38
39
class Clock{
private int sec;
private float min;
private float hour;
int totalSec;
public void setHourMinSec(float hour, float min , int sec){
this.hour=hour;
this.min=min;
this.sec=sec;
}
int getSec(){ return sec ;}
float getMin(){ return min;}
float getHour(){ return hour;}
public int convertToSec(float hour, float min){
totalSec =(int)(hour*3600+min*60);
return totalSec;
}
public void secRecipocal(){
int backHour= totalSec/3600;
System.out.println(backHour);
totalSec-=totalSec*backHour;
int backMinute=totalSec/60;
System.out.println(backMinute);
}
}
public class Test {
public static void main(String[] args) {
Clock c1= new Clock();
c1.setHourMinSec(3,50,0);
System.out.println(c1.convertToSec(3,50));
}
}