-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModifications.java
More file actions
70 lines (57 loc) · 1.78 KB
/
Modifications.java
File metadata and controls
70 lines (57 loc) · 1.78 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.time.LocalDate;
import java.util.List;
public class Customer {
private int id;
private String name;
private LocalDate dob;
private String custType;
private String gender;
private String contactNo;
private String emailId;
private LocalDate registrationDate;
private String country;
private String zone;
public Customer(List<Object> values) {
this.id = (int) values.get(0);
this.name = (String) values.get(1);
this.dob = (LocalDate) values.get(2);
this.custType = (String) values.get(3);
this.gender = (String) values.get(4);
this.contactNo = (String) values.get(5);
this.emailId = (String) values.get(6);
this.registrationDate = (LocalDate) values.get(7);
this.country = (String) values.get(8);
this.zone = (String) values.get(9);
}
// getters and setters
}
List<Object> values = Arrays.asList(1, "John Doe", LocalDate.of(1990, 5, 1), "Gold", "Male", "1234567890", "johndoe@example.com", LocalDate.now(), "USA", "EST");
Customer customer = new Customer(values);
public String getZone() {
String zone;
switch (this.country.toLowerCase()) {
case "china":
zone = "Asia/Shanghai";
break;
case "japan":
zone = "Asia/Tokyo";
break;
case "india":
zone = "Asia/Kolkata";
break;
case "united states":
zone = "America/New_York";
break;
case "united kingdom":
zone = "Europe/London";
break;
case "france":
zone = "Europe/Paris";
break;
default:
// default to GMT if no timezone is found
zone = "GMT";
break;
}
return zone;
}