-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCD.java
More file actions
executable file
·46 lines (35 loc) · 997 Bytes
/
CD.java
File metadata and controls
executable file
·46 lines (35 loc) · 997 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
42
43
44
45
46
public class CD extends MemoriaS {
public static final int ABERTO = 1;
public static final int FECHADO = 0;
private int estado;
public CD(int newTotal, int newUnidade) {
super(newTotal, newUnidade);
this.estado = ABERTO;
}
public double getPerda() {
return .98;
}
public double getEspacoDisponivelRealKB() {
return this.total * this.getPerda();
}
public boolean GravaKB(int newTamanho){
if (this.estado == ABERTO)
return super.GravaKB(newTamanho);
else
return false;
}
public String getEstado(){
if (this.estado == ABERTO)
return "ABERTO";
else
return "FECHADO";
}
public String toString(){
String _tmp = "CD Estado " + this.getEstado() + "\n";
_tmp += "Percentual Disponível " + this.getPercentualDisponivel() + "%\n";
_tmp += "Espaço Total " + this.total + "KB\n";
_tmp += "Espaço Disponível Real " + this.getEspacoDisponivelRealKB() + "KB\n";
_tmp += "Perda " + (100 - (100 * this.getPerda())) + "%";
return _tmp;
}
}