forked from mpmenne/launchcode-java-class
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputer.java
More file actions
59 lines (49 loc) · 1.38 KB
/
Copy pathComputer.java
File metadata and controls
59 lines (49 loc) · 1.38 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
/**
* Created by dshook on 4/28/15.
*/
public class Computer {
private String keyboard;
private int memory;
private double screen;
private int processor;
private String brand;
public Computer(String keyboard, int memory, double screen, int processor, String b) {
this.keyboard = keyboard;
this.memory = memory;
this.screen = screen;
this.processor = processor;
this.brand = b;
}
public String getBrand() {
return this.brand;
}
public void setBrand(String b) {
this.brand = b;
}
public int getProcessor() {
return this.processor;
}
public int getMemory() {
return this.memory;
}
public void setMemory(int mem) {
this.memory = mem;
}
public void addMemory(int newMem) {
int blah = 2;
if (this.memory + newMem < 8) {
this.setMemory(this.memory + newMem);
} else {
System.out.println("Max memory reached");
}
}
public static void main(String args[]) {
Computer c = new Computer("English", 8, 13.5, 10000000, "Lenovo");
Computer mac = new Computer("English", 4, 15, 1000000, "Apple");
System.out.println(c.getBrand());
System.out.println(mac.getBrand());
c.setBrand("Apple");
System.out.println(c.getBrand());
c.addMemory(2);
}
}