-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectronic.java
More file actions
41 lines (32 loc) · 809 Bytes
/
Electronic.java
File metadata and controls
41 lines (32 loc) · 809 Bytes
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
/**
* An instantiable class of electronic item
*
* @author Elena Bollini
*/
public class Electronic {
//declare variable
private String name;
private int price;
private int quantity;
//create an object of Electronic data type
//Electronic() constructor
public Electronic(String name, int price, int quantity) {
this.name = name;
this.price = price;
this.quantity = quantity;
}
//declare getter methods
public String getName() {
return name;
}
public int getPrice() {
return price;
}
public int getQuantity() {
return quantity;
}
// method display electronic
public void displayElectronic() {
System.out.println(this.name + " " + this.price + " " + this.quantity);
}
}