-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop4.java
More file actions
118 lines (59 loc) · 1.6 KB
/
Copy pathoop4.java
File metadata and controls
118 lines (59 loc) · 1.6 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import java.util.Scanner;
class Appointments{
public String description;
public String date;
public int year;
int[] day = new int[31];
public boolean appointment;
public int month;
public void start(){
if(appointment){
System.out.println("Your appointment has been booked....");
}
else
{
System.out.println("sorry appointment are closed now");
}
}
public void startappointment(){
appointment=true;
}
public void BookAppointment(){
Scanner s1 = new Scanner(System.in);
System.out.println("Enter appointment date");
date = s1.nextLine();
System.out.println("Enter appointment day in number");
day[0] = s1.nextInt();
System.out.println("Enter appointment month in number");
month = s1.nextInt();
System.out.println("Enter appointment year in number");
year = s1.nextInt();
System.out.println("Enter appointment description");
description = s1.nextLine();
}
}
class OneTime extends Appointments{
}
class Daily extends Appointments{
}
class monthly extends Appointments{
public void monthlyappointment(){
super.BookAppointment();
int i;
if ((month == 1) || (month == 3) || (month == 5)|| (month == 7)|| (month == 8) || (month == 10) || (month == 12)){
for(i=1;i==day[0];i++)
{
System.out.printf("%d is matched by the month ",day[i]);
}
}
}
}
class Test_Inheritance{
public static void main(String args[])
{
Appointments patient1 = new Appointments();
patient1.startappointment();
patient1.start();
monthly patient2 = new monthly();
patient2.monthlyappointment();
}}