-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppointmentTester.java
More file actions
55 lines (28 loc) · 1.25 KB
/
AppointmentTester.java
File metadata and controls
55 lines (28 loc) · 1.25 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
//define the method AppointmentTester
public class AppointmentTester {
//define main method
public static void main(String[] args) {
//print the message
System.out.print("Daily is subclass of Appointment: ");
//get the super class of appoinment, if it is Daily print true, false otherwise
System.out.println(Daily.class.getSuperclass() == Appointment.class);
//print the expected result
System.out.println("Expected: true");
//print the message
System.out.print("Daily appointments have no extra fields:");
// if Daily has no extra fields print true
System.out.println(Daily.class.getDeclaredFields().length == 0);
//print the expected value
System.out.println("Expected: true");
// Try some appointments
Appointment obj = new Daily("walk the dog");
//print the daily appoinment
System.out.println("Checking daily appointment: " + obj);
//print the expected appoinment
System.out.println("Expected: walk the dog");
//call the method occursOn on a particular date. print the result
System.out.println(obj.occursOn(2016, 12, 25));
//print the expected result
System.out.println("Expected: true");
}
}