Repository navigation
Expand file tree
/
Copy pathMain.java
More file actions
67 lines (62 loc) · 2.68 KB
/
Copy pathMain.java
File metadata and controls
67 lines (62 loc) · 2.68 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
package com.company;
import One.Patient;
import One.Vaccine;
import Two.Address;
import java.util.Date;
import java.util.Scanner;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
static Scanner scanner = new Scanner(System.in);
private static String [] monthly = {"January","February","March","April","May","June","July","August","September","October","November","December"};
private static Vaccine changetime;
public static void main(String[] args) {
// write your code here
welcome();
// Patient p1 = new Patient("Cuong", 23, "levietcuongdn98@gmail.com", "0985001998", null);
// Patient p2 = new Patient("Cuong", 23, "levietcuongdn98@gmail.com", "0985001998", null);
Vaccine v1 = new Vaccine("May 5, 2021", "August 6,2021", Vaccine.type_vaccine.Pfizer);
// Vaccine.DateDiff();
changetime();
System.out.println(v1);
Vaccine.Clinic();
}
public static void welcome(){
System.out.println(" ------------------------------");
System.out.println(" WELCOME TO VACCINE BOOKING");
System.out.println(" ------------------------------");
}
public static void changetime(){
System.out.println("DO YOU WANT TO CHANGE THE DATE OF VACCINATION? ");
String t = scanner.nextLine();
int kq1 = 1;
do{
if (t.equals("YES")) {
int year=0,year1=0,month=0,month1=0,day=0,day1=0;
int kq = 0;
System.out.println("Day for 1st dose: ");
year = scanner.nextInt();
month = scanner.nextInt();
day = scanner.nextInt();
System.out.println("Day for 2nd dose: ");
year1 = scanner.nextInt();
month1 = scanner.nextInt();
day1 = scanner.nextInt();
kq = Vaccine.set_time(year1,month1,day1)-Vaccine.set_time(year,month,day);
if (kq>28 && kq<=256) System.out.println("Valid day");
else System.out.println("Invalid day");
String day_1 = monthly[month-1] + " " + String.valueOf(day) + ", " + String.valueOf(year);
String day_2 = monthly[month1-1] + " " + String.valueOf(day1) + ", " + String.valueOf(year1);
Vaccine v1 = new Vaccine(day_1,day_2, Vaccine.type_vaccine.Pfizer);
// System.out.println(day_1);
// System.out.println(kq);
} else
System.out.println("DO YOU WANT TO CHANGE AGAIN? ");
t = scanner.nextLine();
if (t.equals("NO")){
break;
}
} while (kq1>0);
}
}