Advertisement
Guest User

PiecsetPlus

a guest
Feb 22nd, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Osoby {
  4.  
  5.     String imie;
  6.     String nazwisko;
  7.     int[] rok;
  8.  
  9.         public Osoby(String imie, String nazwisko, int liczba){
  10.             rok = new int[liczba];
  11.             this.imie = imie;
  12.             this.nazwisko = nazwisko;
  13.         }
  14.  
  15.         public void Dziecko(int numer, int wiek){
  16.             rok[numer] = wiek;
  17.         }
  18.  
  19.         public int Dodatek(){
  20.             int count = 0;
  21.             for(int i = 0; i < rok.length; i++){
  22.                 if(rok[i] <= 18){
  23.                     count++;
  24.                 }
  25.             }
  26.             return 500*count;
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement