-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculos.java
67 lines (55 loc) · 1.54 KB
/
Calculos.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
/*
* 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 Victor_Tesoura;
import java.util.Vector;
/**
*
* @author Victor
*/
public class Calculos {
public Calculos() {
}
//**Defesa**//metodo para acumular o total
public double total(int bilhete, double preco) {
double total = 0;
total = bilhete * preco;
return total;
}
//**Defesa**//metodo para acumular bilhetes
public int bilhetes(int bilhete) {
int total = 0;
total += bilhete;
return total;
}
//metodo para calcular o numero total de bilhetes
public int CalcularBilhetes(Vector e) {
int total = 0;
Evento ev;
Pago pg;
for (int i = 0; i < e.size(); i++) {
ev = (Evento) e.elementAt(i);
if (ev instanceof Pago) {
pg = (Pago) ev;
total += pg.calcularBilhetes();
}
}
return total;
}
//metodo para calcular o total que sera arrecadado
public double CalcularTotal(Vector e) {
double total = 0;
Evento ev;
Pago pg;
for (int i = 0; i < e.size(); i++) {
ev = (Evento) e.elementAt(i);
if (ev instanceof Pago) {
pg = (Pago) ev;
total += pg.calcularTotal();
}
}
return total;
}
}