BalloonFamily.java
package balloonpeople;

import painter.SPainter;

import javax.swing.*;
import java.util.ArrayList;
import java.util.Scanner;

public class BalloonFamily {

               private ArrayList<BalloonPerson> balloonPeople;

               public BalloonFamily(int nrOfPeople) {
                   this.balloonPeople = new ArrayList<>(nrOfPeople);
                  for (int x = 1; x <= nrOfPeople; x++) {
                           String name = getName("Name of family member # " + x + ": ");
                           int age = getAge("Age of family member " + x + ": ");
                           double height = getHeight("Height of family member # " + x + ": ");
                           balloonPeople.add(new BalloonPerson(name, age, height));
                       }
               }

               private String getName(String prompt) {
                   String input = JOptionPane.showInputDialog(null, prompt + "?");
                   Scanner scanner = new Scanner(input);
                   return scanner.next();
              }

               private int getAge(String prompt) {
                   String input = JOptionPane.showInputDialog(null, prompt + "?");
                   Scanner scanner = new Scanner(input);
                   return scanner.nextInt();
               }

               private double getHeight(String prompt) {
                   String input = JOptionPane.showInputDialog(null, prompt + "?");
                   Scanner scanner = new Scanner(input);
                   return scanner.nextDouble();
               }

               public String toString() {
                   int i = 0;
                   while (i < balloonPeople.size()) {
                           System.out.println(balloonPeople.get(i));
                           i++;
                       }
                   return null;
              }

               public void painter(SPainter painter) {
                   double y = painter.getWidth()/balloonPeople.size();
                 if ( y < 100) {
            painter.draw("Too many family members selected, choose less " +
                                           "Max: 4");
                       } else {
                           painter.mlt((painter.getWidth()/2)-(y/2));
                           for (int i = 0; i < balloonPeople.size(); i++) {
                                   balloonPeople.get(i).paintBalloonPerson(painter);
                                   painter.mrt(y);

                               }
                       }
              }
   }