-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmail.java
49 lines (41 loc) · 1.39 KB
/
Email.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
// Represents an email that is send from a sender to a receiver
class Email {
private boolean isNew; // Represents if the email is read or not
private String sender; // The sender of this email
private String receiver; // The receiver this this email
private String subject; // The subject of this email
private String mainBody; // The text of this email
// Constructor of class Email
// Gets four String parameters for the sender, receiver, subject, mainBody of the Email
Email(String sender, String receiver, String subject, String mainBody){
this.isNew = true;
this.sender = sender;
this.receiver = receiver;
this.subject = subject;
this.mainBody = mainBody;
}
// Returns true if the Email is new
boolean isNew() {
return isNew;
}
// Sets that this Email is not new anymore
void setNew() {
isNew = false;
}
// Returns a String with the name of the sender
String getSender() {
return sender;
}
// Returns a String with the name of the receiver
String getReceiver() {
return receiver;
}
// Returns a String with the subject of the Email
String getSubject() {
return subject;
}
// Returns a String with the content of the Email
String getMainBody() {
return mainBody;
}
}