teaching machines

CS1: Lecture 32 – More Objects

Dear students,

Last time we started our discussion of objects. We continue that discussion today with more examples. Out of concrete examples we build generalized knowledge, right? It’s not the other way around. At this point in the learning process, seeing patterns is more important than feeling like you understand objects. Both need to happen eventually, of course.

As a quick reminder, an object is a marriage between data and code. An object’s data is automatically accessible to all of its methods—it doesn’t need to get sent around via parameters. An object’s code is executed in the context of the object. This is unlike static methods, which don’t have any context or individualized state.

Raffle

For our next example of an object, let’s model a raffle. What are the behaviors we need to support?

  • selling tickets or adding names
  • drawing out a random name
  • resetting

What state do we need to implement these behaviors?

  • a list of names
  • maybe a random number generator

Add a constructor and we’ve got ourselves a raffle.

Something we should think about is what to do if we try to draw out a name but there isn’t one to draw. Probably we should strengthen our object by adding a behavior that reports the number of names. Others can use this behavior to prevent drawing when it wouldn’t succeed. Additionally, we might want to add a check in the actual draw method that provides an appropriate exception.

Another thing we should think about is access to our instance variables. If we do not mark our instance variables private, any entity outside our class can reach inside and muck with our data without following the rules we impose. For instance, someone might reach inside and add their name to our list without going through our add method, circumventing any code we have controlling that behavior.

Card and Deck

Let’s get a couple of objects working together. We’ll model a card and a deck.

A card’s state is its suit and rank. We will predefine a bunch of possibilities for these suits and ranks using static constants. It might have behaviors like reporting its suit and rank or comparing itself to another card.

There’s a special behavior called toString that we can implement to make printing our objects easier. We’ll make use of the following arrays to turn our card’s state into a user-facing string:

// hearts, diamonds, spades, clubs
String[] suits = {"\u2665", "\u2666", "\u2660", "\u2663"};
String[] ranks = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};

A deck’s state is a sequence of cards. It might have behaviors like drawing a card or shuffling itself. If our cards are stored in a list or array, we can implement the Fisher-Yates algorithm to shuffle:

for each index i in reverse
  j = random number in [0, i]
  swap items i and j

After we get these two classes implemented, we’ll try out a little game:

A well-dressed man approaches you with two decks of cards in hand. He says, “Let us play a game. Here’s your deck. Here is mine. We turn over our cards one at a time. If any match, I win and you give me $5. If none match, you win and I give you $5.” Should you play this game?

TODO

Here’s your TODO to complete before we meet again:

  • Midterm 2 is on Monday, November 25. The structure will be the same as before. During the exam, you may consult one page of hand-written notes that you have made. The topics that we’ve been discussing since the last exam include conditional statements, loops, arrays, and ArrayList. So that I may have time to grade and that you may rest, we will not have lab next week on November 26.
  • CS 148, your lab is posted.
  • Read chapter 8. On a quarter sheet a paper to be turned in at the beginning of next lecture, write down 2-3 questions, observations, or points of confusion from your reading.

See you next class!

Sincerely,

P.S. It’s time for a haiku!

Each snowflake’s unique
This one cares about the poor
That one immigrants

P.P.S. Here’s the code we wrote together…

Card.java

package lecture1120.cs145;

public class Card {
  public static final int ACE = 1;
  public static final int TWO = 2;
  public static final int THREE = 3;
  public static final int FOUR = 4;
  public static final int FIVE = 5;
  public static final int SIX = 6;

  public static final int HEARTS = 0;
  public static final int DIAMONDS = 1;
  public static final int CLUBS = 2;
  public static final int SPADES = 3;

  private static final String[] suits = {"\u2665", "\u2666", "\u2660", "\u2663"};
  private static final String[] ranks = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};

  private int rank;
  private int suit;

  public Card(int rank, int suit) {
    this.rank = rank;
    this.suit = suit;
  }

  public String toString() {
    return String.format("%s%s", ranks[rank - 1], suits[suit]);
  }
}

CardTest.java

package lecture1120.cs145;

public class CardTest {
  public static void main(String[] args) {
    Card card = new Card(Card.FOUR, Card.HEARTS);
    System.out.println(card);
  }
}

Raffle.java

package lecture1120.cs145;

import java.util.ArrayList;
import java.util.Random;

public class Raffle {
  private ArrayList<String> names;
  private Random generator;

  public Raffle() {
    this.names = new ArrayList<String>();
    this.generator = new Random();
  }

  public void add(String name) {
    if (!name.equals("Jill")) {
      this.names.add(name);
    }
  }

  public String draw() {
    if (names.isEmpty()) {
      throw new IllegalStateException("No names left. Bummer.");
    }
    int i = generator.nextInt(names.size());
    return names.remove(i);
  }
}

RaffleTest.java

package lecture1120.cs145;

public class RaffleTest {
  public static void main(String[] args) {
    Raffle raffle = new Raffle();
    raffle.add("Christian");
    raffle.add("Aloisius");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Blake");
    raffle.add("Corey");
    raffle.add("Maria");
    raffle.add("Mike");
    raffle.add("Ryan");

//    for (int i = 0; i < 1000; i++) {
//      raffle.names.add("Jill");
//    }

    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
    System.out.println(raffle.draw());
  }
}

Foobag.java

package lecture1120.cs148;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Scanner;

public class Foobag {
  public static void main(String[] args) {
    ArrayList list = new ArrayList();
    list.add("foo");
    list.add(new Scanner (System.in));
    list.add(new NegativeArraySizeException());
    list.add(Color.CYAN);
    list.add(new BufferedImage(3, 2, 5));



    String name = (String) list.get(1);
  }
}

Raffle.java

package lecture1120.cs148;

import java.util.ArrayList;
import java.util.Random;

public class Raffle {
  ArrayList<String> names;
  private Random generator;

  public Raffle() {
    names = new ArrayList<>();
    generator = new Random();
  }

  public String draw() {
    int i = generator.nextInt(names.size());
    return names.remove(i);
  }

  public void add(String name) {
    if (!name.equals("Jill")) {
      names.add(name);
    }
  }
}

RaffleTest.java

package lecture1120.cs148;

public class RaffleTest {
  public static void main(String[] args) {
    Raffle raffle = new Raffle();
    raffle.add("Alex");
    raffle.add("Adan");
    raffle.add("Zach");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Jill");
    raffle.add("Nathan");

    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");
    raffle.names.add("Jill");

    System.out.println(raffle.draw());
  }
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *