Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Bank{
- Konto[] k = new Konto[Konto.iloscKont];
- public Bank() {
- for(int i=0;i<Konto.iloscKont;i++) {
- k[i]=new Konto();
- }
- }
- public Konto[] getK() {
- return k;
- }
- public void setK(Konto[] k) {
- this.k = k;
- }
- void print() {
- for(int i=0;i<Konto.iloscKont;i++) {
- System.out.println("Konto "+(i+1)+": "+k[i].getKasa());
- }
- }
- void suma() {
- int suma=0;
- for(int i=0;i<Konto.iloscKont;i++) {
- suma=suma+k[i].getKasa();
- }
- System.out.println("Suma: "+suma);
- }
- public static void main(String[] args) {
- Bank b= new Bank();
- b.print();
- b.suma();
- Watek[] w = new Watek[Watek.iloscWatkow];
- for(int i=0;i<Watek.iloscWatkow;i++) {
- w[i] = new Watek(b);
- w[i].start();
- try {w[i].join();} catch(InterruptedException e) {}
- }
- b.print();
- b.suma();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement