-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeDemo.java
43 lines (27 loc) · 853 Bytes
/
TimeDemo.java
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
//Captain-Price-TF-141
package milTime;
import java.util.Scanner;
/**
This program demonstrates the Time class.
*/
public class TimeDemo
{
public static void main(String[] args)
{
@SuppressWarnings("resource")
Scanner keyboard = new Scanner(System.in);
char answer = 'Y';
String enteredTime;
String response;
while(Character.toUpperCase(answer) == 'Y')
{
System.out.print("Enter a military time using the ##:## format: ");
enteredTime = keyboard.nextLine();
@SuppressWarnings("unused")
Time now = new Time (enteredTime);
System.out.println("Do you want to enter another (Y/N)? ");
response = keyboard.nextLine();
answer = response.charAt(0);
}
}
}