forked from upgrad-edu/tm-java-git-q-new-branch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassenger.java
More file actions
46 lines (37 loc) · 1.3 KB
/
Copy pathPassenger.java
File metadata and controls
46 lines (37 loc) · 1.3 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
package com.company;
public class Passenger {
public int id;
public static class Address {
String street, city, state;
public Address(String street, String city, String state) {
this.street = street;
this.city = city;
this.state = state;
}
}
public Address address;
public static class Contact {
String name, phone, email;
public Contact(String name, String phone, String email) {
this.name = name;
this.phone = phone;
this.email = email;
}
}
public Contact contact;
public Passenger(String addressStreet, String addressCity,
String addressState, String contactName, String contactPhone,
String contactEmail) {
this.address = new Address(addressStreet, addressCity, addressState);
this.contact = new Contact(contactName, contactPhone, contactEmail);
}
public int getId() {
return this.id;
}
public String getAddressDetails() {
return address.street + ", " + address.city + ", " + address.state;
}
public String getContactDetails() {
return contact.name + ", " + contact.phone + ", " + contact.email;
}
}