-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.java
More file actions
71 lines (56 loc) · 1.99 KB
/
Product.java
File metadata and controls
71 lines (56 loc) · 1.99 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
public class Product {
private String model;
private String manufacturer;
private int width;
private int height;
private int depth;
public Product(String model, String manufacturer) {
this.model = model;
this.manufacturer = manufacturer;
}
}
class Monitor extends Product{
private int size;
private String resolution;
public Monitor(String model, String manufacturer) {
super(model, manufacturer);
}
public Monitor(String model, String manufacturer, int size, String resolution) {
super(model, manufacturer);
this.size = size;
this.resolution = resolution;
}
public void drawPixelAt(int x, int y, String color){
System.out.println(String.format("Drawing pixel at %d,%d in color %s ", x, y, color));
}
}
class Motherboard extends Product{
private int rmaSlots;
private int cardSlots;
private String bios;
public Motherboard(String model, String manufacturer) {
super(model, manufacturer);
}
public Motherboard(String model, String manufacturer, int rmaSlots, int cardSlots, String bios) {
super(model, manufacturer);
this.rmaSlots = rmaSlots;
this.cardSlots = cardSlots;
this.bios = bios;
}
public void loadProgram (String programName){
System.out.println("Program " + programName + " is now loading...");
}
}
class ComputerCase extends Product{
private String powerSupply;
public ComputerCase(String model, String manufacturer) {
super(model, manufacturer);
}
public ComputerCase(String model, String manufacturer, String powerSupply) {
super(model, manufacturer);
this.powerSupply = powerSupply;
}
public void pressPowerButton(){
System.out.println("Power button pressed");
}
}