// Path: Chapter9/PP1/NegativeNumberException.java
// public class NegativeNumberException extends Exception
// {
// // Default Constructor
//     public NegativeNumberException()
//     {
//         super("N must be positive.");
//     }
// // 1 arg Constructor (string)
//     public NegativeNumberException(String message)
//     {
//         super(message);
//     }
// }


import tomas.ochoa.NegativeNumberException;
import java.util.Scanner;

package tomas.ochoa;

/**
 * Created by Tom's Desktop on 3/24/2016.
 *
 * Program:
 *  - Calculates the average of N integers
 *
 *  -Prompt user for input:
 *      - Prompt user:
 *      - try
 *          - get integer
 *          - throw exception
 *      - catch(negative exception)
 *            - if negative
 *              - show error
 *              - get input
 *              - keep trying until not negative
 *      - calculate average
 *      - show
 */

public class Main
{
    public static void main(String[] args)
    {
    // Int for N
        int n = 0;
    // Scanner for keyboard
        Scanner keyboard = new Scanner(System.in);

    // First try block to check if N is positive
        try
        {
            System.out.print("Enter N: ");
            n = keyboard.nextInt();
            if(n < 0)

// Path: Chapter9/PP1/NegativeNumberException.java
// public class NegativeNumberException extends Exception
// {
// // Default Constructor
//     public NegativeNumberException()
//     {
//         super("N must be positive.");
//     }
// // 1 arg Constructor (string)
//     public NegativeNumberException(String message)
//     {
//         super(message);
//     }
// }


// Path: Chapter9/PP1/Main.java
import tomas.ochoa.NegativeNumberException;
import java.util.Scanner;

package tomas.ochoa;

/**
 * Created by Tom's Desktop on 3/24/2016.
 *
 * Program:
 *  - Calculates the average of N integers
 *
 *  -Prompt user for input:
 *      - Prompt user:
 *      - try
 *          - get integer
 *          - throw exception
 *      - catch(negative exception)
 *            - if negative
 *              - show error
 *              - get input
 *              - keep trying until not negative
 *      - calculate average
 *      - show
 */

public class Main
{
    public static void main(String[] args)
    {
    // Int for N
        int n = 0;
    // Scanner for keyboard
        Scanner keyboard = new Scanner(System.in);

    // First try block to check if N is positive
        try
        {
            System.out.print("Enter N: ");
            n = keyboard.nextInt();
            if(n < 0)

                throw new NegativeNumberException();
