/*
 * File: GrandOpening.java
 * -----------------------
 * This program runs the Grand Opening of the Stanford
 * dog park; allows dogs to register and assigns them
 * treats and (randomly) a squeaky toy.
 */

import acm.program.*;
import acm.util.*;

public class GrandOpening extends ConsoleProgram {
	
	public void run() {
		println("Welcome to the Grand Opening of the new Stanford Dog Park!\n");
		
		int totNumTreats = 0;
		
		String name = readLine("What is your dog's name? ");
		while (!name.isEmpty()) {
			int size = readInt("How big is your dog? Enter a number: 1 - small, 2 - medium, 3 - large ");
					
			// calculate num treats
			int numTreats = size * 2;
			totNumTreats += numTreats;
			println("Oh boy! " + name + " gets " + numTreats + " dog treats!");
			
			// calculate if dog gets squeaky toy
			boolean getsToy = RandomGenerator.getInstance().nextBoolean(0.25);
			if (getsToy) {
				println(name + " also won a squeaky toy!");
			}
			
			// prompt for new name
			name = readLine("What is your dog's name? ");
		}
		
		// at the end of the program, print total number of treats
		println("At the grand opening, there will be " + totNumTreats + " dog treats!");
	}
}