-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathThreadOperation.java
More file actions
38 lines (30 loc) · 904 Bytes
/
Copy pathThreadOperation.java
File metadata and controls
38 lines (30 loc) · 904 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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package banco;
/**
*
* @author zebastit
*/
public class ThreadOperation extends Thread {
private int temp = 0, numop = 0, start = 2, pers;
private String Operands[];
public ThreadOperation(int pers, String Operands[]) {
this.pers = pers;
this.Operands = Operands;
}
@Override
public void run() {
numop = Integer.parseInt(Operands[pers]);
if (pers == 1) {
start = 2 + Integer.parseInt(Operands[0]);
}
for (int i = start; i < numop + start; i++) {
temp = Banco.getCuenta();
//System.out.println("Se esta sumando " + Operands[i] + " con " + temp + "por la persona" + pers);
temp = temp + Integer.parseInt(Operands[i]);
Banco.setCuenta(temp);
}
}
}