-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElectronic.java
71 lines (60 loc) · 1.54 KB
/
Electronic.java
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package a3nesbittr;
/**
*
* @author Ryan
*/
public class Electronic extends Product {
private final String maker;
Electronic(String id, int year, double price, String name, String maker) throws Exception {
super(id, year, price, name);
this.maker = maker;
}
/**
* overrides the parent class and adds the additional attributes of Electronics
* @return
*/
@Override
public String dataDump() {
String string = this.getID() + "\n" + this.getName() + "\n" + this.getPrice() + "\n" + this.getYear() + "\n" + this.getMaker() + "\n";
return string;
}
/**
* @return maker of electronic (string)
*/
public String getMaker() {
return this.maker;
}
/**
* prints the output with the additional attributes of Electronics
* @return string output for file
*/
@Override
public String printOutput() {
return (super.printOutput() + "\nmaker = " + this.getMaker() + "\n");
}
@Override
public String getID() {
return this.productID;
}
@Override
public int getYear() {
return this.year;
}
@Override
public double getPrice() {
return this.price;
}
@Override
public String getName() {
return this.name;
}
@Override
public boolean isBook() {
return false;
}
}