Advertisement
FacundoCruz

TP5-PUNTO4

May 12th, 2022
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. package tp05;
  2.  
  3. public class Extraccion extends Thread {
  4.  
  5. private RegionCritica cuenta;
  6.  
  7. public Extraccion(RegionCritica cont) {
  8.  
  9. cuenta = cont;
  10. }
  11.  
  12. @Override
  13. public void run() {
  14.  
  15. try {
  16.  
  17. while(cuenta.GetContador()<500) {}
  18.  
  19. sleep(100);
  20.  
  21. double i = cuenta.GetContador();
  22.  
  23. cuenta.setContador(i-500);
  24.  
  25. System.out.println("Extraccion exitosa : ");
  26.  
  27. System.out.println("Saldo actual : "+cuenta.GetContador());
  28.  
  29. }catch (InterruptedException e) {
  30. System.out.println("ERROR EXTRACCION...");
  31. }
  32. }
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement