Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class Bank{
  4.  
  5. Konto[] k = new Konto[Konto.iloscKont];
  6.  
  7. public Bank() {
  8. for(int i=0;i<Konto.iloscKont;i++) {
  9. k[i]=new Konto();
  10. }
  11. }
  12.  
  13. public Konto[] getK() {
  14. return k;
  15. }
  16. public void setK(Konto[] k) {
  17. this.k = k;
  18. }
  19.  
  20. void print() {
  21.  
  22. for(int i=0;i<Konto.iloscKont;i++) {
  23. System.out.println("Konto "+(i+1)+": "+k[i].getKasa());
  24. }
  25.  
  26. }
  27.  
  28. void suma() {
  29.  
  30. int suma=0;
  31. for(int i=0;i<Konto.iloscKont;i++) {
  32. suma=suma+k[i].getKasa();
  33. }
  34. System.out.println("Suma: "+suma);
  35. }
  36.  
  37.  
  38.  
  39. public static void main(String[] args) {
  40. Bank b= new Bank();
  41. b.print();
  42. b.suma();
  43. Watek[] w = new Watek[Watek.iloscWatkow];
  44. for(int i=0;i<Watek.iloscWatkow;i++) {
  45. w[i] = new Watek(b);
  46. w[i].start();
  47. try {w[i].join();} catch(InterruptedException e) {}
  48. }
  49.  
  50. b.print();
  51. b.suma();
  52. }
  53.  
  54.  
  55.  
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement