Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. package huiswerk.week3;
  2.  
  3. public class Circus {
  4.     private String naam;
  5.     private Artiest[] artiesten;
  6.  
  7.     public Circus(String naam) {
  8.         this.naam = naam;
  9.         artiesten = new Artiest[3];
  10.         artiesten[0] = new Artiest("De Lawineboys");
  11.         artiesten[1] = new Artiest("Stef Ekkel");
  12.         artiesten[2] = new Artiest("Rene Kars");
  13.     }
  14.  
  15.     public String getNaam() {
  16.         return this.naam;
  17.     }
  18.  
  19.     public void printArtiesten() {
  20.         System.out.println("Circus " + this.naam + " heeft de volgende " + getAantalArtiesten() + " artiesten:");
  21.  
  22.         for (int i = 0; i < artiesten.length; i++) {
  23.             System.out.println("* artiest nr. " + (i+1) + " = " + artiesten[i].getNaam() + " (een artiest)");
  24.         }
  25.     }
  26.  
  27.     public int getAantalArtiesten() {
  28.         return artiesten.length;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement