-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhone.java
More file actions
38 lines (30 loc) · 1.14 KB
/
Phone.java
File metadata and controls
38 lines (30 loc) · 1.14 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
package Java.BuilderDesignPatternExample;
public class Phone {
//required parameters
private String os;
private String processor;
private float screenSize;
private int batteryCapacity;
private int cameraPixel;
//optional parameters
private boolean vrSupport;
public Phone(PhoneBuilder builder) {
this.os = builder.getOS();
this.processor = builder.getProcessor();
this.screenSize = builder.getScreenSize();
this.batteryCapacity = builder.getBatteryCapacity();
this.cameraPixel = builder.getCameraPixel();
this.vrSupport = builder.getVRSupport();
}
public Phone() {
}
@Override
public String toString() {
return "Phone [os=" + os + ", processor=" + processor + ", screen size=" + screenSize + ", battery capacity=" + batteryCapacity +", camera pixels=" + cameraPixel+ "]";
}
public String getOS() {return os; }
public String getProcessor() { return processor; }
public float getScreenSize() { return screenSize; }
public int getBatteryCapacity() { return batteryCapacity; }
public int getCameraPixel() { return cameraPixel; }
}