-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewRecipientFactory.java
More file actions
50 lines (42 loc) · 1.27 KB
/
NewRecipientFactory.java
File metadata and controls
50 lines (42 loc) · 1.27 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
package emailClient;
import java.io.FileWriter;
import java.io.IOException;
public class NewRecipientFactory extends file{
private String str;
public NewRecipientFactory(String str) throws IOException {
this.str=str;
}
public void method() throws IOException {
try {
String[] parts = str.split("\\s+");
String part1 = parts[0];
String part2 = parts[1];
file f = new file(); //add to the file
f.write(part2);
}catch(Exception e) {
System.out.println("Invalid form of inputs");
}
System.out.println("new recipient successfully added");
/*if(part1.equalsIgnoreCase("Official:")) {
//System.out.println("Official:");
getOfficial();
}else if(part1.equalsIgnoreCase("Personal:")) {
//System.out.println("Personal:");
getPersonal();
}else if(part1.equalsIgnoreCase("Office_friend:")){
//System.out.println("Office_friend:");
getOffice_friend();
}else {
System.out.println("invalid input");
} */
}
public Official getOfficial() {
return new Official();
}
public Personal getPersonal() {
return new Personal();
}
public Office_friend getOffice_friend() {
return new Office_friend();
}
}