-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy path2.7.8 Auto-fill (Part 2)
63 lines (54 loc) · 1.62 KB
/
2.7.8 Auto-fill (Part 2)
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
public class FormFill
{
private String fName;
private String lName;
private String email;
private int birthMonth;
private int birthYear;
// Constructor that sets the first and last name
// The other variables will initialize themselves
public FormFill(String firstName, String lastName){
fName = firstName;
lName = lastName;
}
// Sets birthMonth and birthyear to the given
// values
public void setBirthday(int month, int year){
birthMonth = month;
birthYear = year;
}
// Sets the email address
public void setEmailAddress(String emailAddress){
email = emailAddress;
}
// Returns a string with the name formatted like
// a doctor would write the name on a file
//
// Return string should be formatted
// with the last name, then a comma and space, then the first name.
// For example: LastName, FirstName
public String fullName(){
return lName + ", " + fName;
}
// Returns basic contact information formatted
// like this example:
//
// LastName
// Email: smith@emailprovider.com
//
// Fill in the last name and email address
// with the instance variables.
//
// You will need to use the escape character \n
// To create a new line in the String
public String contactInformation(){
return lName + "\n" + "Email: " + email;
}
// Returns a string with the birthday
// formatted like this:
//
// month/year
public String birthday(){
return birthMonth + "/" + birthYear;
}
}