-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectronics.java
More file actions
45 lines (34 loc) · 1.25 KB
/
Copy pathElectronics.java
File metadata and controls
45 lines (34 loc) · 1.25 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
public class Electronics extends Product{
private String brand;
private static String category = "Electronics";
private int warranty;
public Electronics(String productID, String productName, int numberofavailableitems, double price, String brand, int warranty){
super(productID,productName,numberofavailableitems,price);
this.brand = brand;
this.warranty = warranty;
}
public String getBrand(){
return this.brand;
}
public void setBrand(String brand){
this.brand = brand;
}
public int getWarranty() {
return this.warranty;
}
public void setWarranty(int warranty) {
this.warranty = warranty;
}
@Override
public String toString(){
return "Category : Electronics , ID : " + super.getProductID() + " , Name : " + super.getProductName() + " , No of available items : "+super.getNumberofavailableitems()+ " , Brand : " + this.brand + ", Price : " + super.getPrice() + ", warranty (years) : " +this.warranty;
}
@Override
public String getCategory(){
return category;
} // returns category of the product
@Override
public String getInfo(){
return(this.brand + " , " + this.warranty + " year warranty");
}
}