-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeD.java
More file actions
69 lines (67 loc) · 1.78 KB
/
TimeD.java
File metadata and controls
69 lines (67 loc) · 1.78 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.Scanner;
public class TimeD
{
public static void main(String[] args)
{
int choice;
Scanner myObj = new Scanner(System.in);
MTime M1=new MTime();
MTime M2=new MTime();
do
{
System.out.println("Enter 1 to Set Time");
System.out.println("Enter 2 Display Time in 24 hour Format");
System.out.println("Enter 3 Display Time in 12 hour Format");
System.out.println("Enter 4 To Add Hours in the Time Entered");
System.out.println("Enter 5 To Add Minutes in the Time Entered");
System.out.println("Enter 6 To Find If Two times are Equal Or Not");
System.out.println("Enter 0 for exit");
choice=myObj.nextInt();
if(choice==1)
{
M1.SetTime();
}
else if(choice==2)
{
M1.FormatTime2();
}
else if(choice==3)
{
M1.FormatTime1();
}
else if(choice==4)
{
System.out.println("Enter Hours You Want To Add in: ");
int h=myObj.nextInt();
M1.Add_hours(h);
}
else if(choice==5)
{
System.out.println("Enter Minutes You Want To Add in: ");
int m=myObj.nextInt();
M1.Add_mins(m);
}
else if(choice==6)
{
System.out.println("Enter Time1: ");
M1.SetTime();
System.out.println("Enter Time2: ");
M2.SetTime();
if(M1.equals(M2))
{
System.out.println("Times Are Equal");
}
else
System.out.println("Times Are NOT Equal");
}
else if(choice==0)
{
System.out.println("Thank You For Using Our Program");
}
else
{
System.out.println("Enter The Right Choice");
}
}while(choice!=0);
}
}