-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTSTClass.java
50 lines (41 loc) · 2.01 KB
/
TSTClass.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
44
45
46
47
48
49
50
package BloodDonationApp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/*************************************************
* *
* here is the test class which test *
* all the classes before *
* run to the user and check *
* if there is any error *
* *
* **********************************************/
public class TSTClass {
public static void main (String[] args) throws ParseException{
BloodCollectionCenter bcCenter= new BloodCollectionCenter("Hittin Center");
Donor donor1= new Donor("salman", "AB positive", "05588937");
System.out.println(donor1.ArrayIdealBLDDonation());
System.out.println(bcCenter.toString());
bcCenter.save();
System.out.println("-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
donor1.AddBloodDonation(new WholeBloodDonation(new SimpleDateFormat("dd/MM/yyyy").parse("18/06/2003")));
donor1.AddBloodDonation(new PlasmaDonation(new SimpleDateFormat("dd/MM/yyyy").parse("17/04/2007")));
donor1.AddBloodDonation(new WholeBloodDonation(new SimpleDateFormat("dd/MM/yyyy").parse("03/11/2010")));
try{
bcCenter.addDonor(donor1);
} catch (DuplicateException ex) {
ex.printStackTrace();
}
System.out.println(bcCenter.toString());
bcCenter.save();
System.out.println("-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
System.out.println(bcCenter.toString());
bcCenter.save();
System.out.println(" *-*-*-*-*-*-* read the data from file *-*-*-*-*-*-*");
try {
bcCenter.loadData();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(bcCenter.toString());
}
}