Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Osoby {
- String imie;
- String nazwisko;
- int[] rok;
- public Osoby(String imie, String nazwisko, int liczba){
- rok = new int[liczba];
- this.imie = imie;
- this.nazwisko = nazwisko;
- }
- public void Dziecko(int numer, int wiek){
- rok[numer] = wiek;
- }
- public int Dodatek(){
- int count = 0;
- for(int i = 0; i < rok.length; i++){
- if(rok[i] <= 18){
- count++;
- }
- }
- return 500*count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement