-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhone.java
More file actions
74 lines (59 loc) · 2.45 KB
/
Phone.java
File metadata and controls
74 lines (59 loc) · 2.45 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
65
66
67
68
69
70
71
72
73
74
/**
* @author Zachary Devore
* Date: 3/13/26
* Section: CSC 311-002
*/
public class Phone extends ElectronicItem {
/** Operating System the phone uses */
private String os;
/** The kind of port the phone uses to charge */
private String chargerPort;
/**
* Constructor for Iphone
*/
public Phone(int itemID, String name, double price, int quantity,
String brand, int warrentyMonths, double powerWatts, boolean isRechargeable,
String os, String chargerPort) {
super(itemID, name, price, quantity, brand, warrentyMonths, powerWatts, isRechargeable); // Calling constructor from ElectronicItem
this.os = os;
this.chargerPort = chargerPort;
}
/**
* Retrieves the phones operating system
* @return the phones operating system
*/
public String getOs() {return this.os;}
/**
* Retrieves the phones charger port
* @return the charger port of the phone
*/
public String getChargerPort() {return this.chargerPort;}
/**
* Sets the operating system of the phone
* @param os
*/
public void setOs(String os) {this.os = os;}
/**
* Sets the chargerPort of the phone
* @param chargerPort
*/
public void setChargerPort(String chargerPort) {this.chargerPort = chargerPort;}
/**
* Represents a Phone with the attributes ItemID, Price, Quantity, Brand, Warrenty Months,
* Power Watts, isRechargable, Operating System, Charger Port.
*/
@Override
public String toString() {
return String.format("ItemID: %d| Name: %s| Price: $%.2f| Quantity: %d| Brand: %s| Warrenty Months: %d| Power Consumption in Watts: %.2f| Is Rechargeable? %b| Operating System: %s| Charger Port: %s",
getItemID(), getName(), getPrice(), getQuantity(), getBrand(), getWarrantyMonths(), getPowerWatts(), getIsRechargable(), getOs(), getChargerPort());
// return "ItemId: " + this.getItemID() +
// "\nPrice: " + this.getPrice() +
// "\nQuantity: " + this.getQuantity() +
// "\nBrand: " + this.getBrand() +
// "\nWarrenty Months: " + this.getWarrentyMonths() +
// "\nPower Watts: " + this.getPowerWatts() +
// "\nisRechargable: " + this.getIsRechargable() +
// "\nOperating System: " + this.getOs() +
// "\nCharger Port: " + this.getChargerPort();
}
}