import java.awt.Point;
import java.util.Scanner;

public class CircleCalculator
{
	// This program will prompt the user for an x and y value
	// for the center of the circle, and the radius of the 
	// circle. The user then will be prompted for an operation 
	// to perform on the circle.
	public static void main(String [] args)
	{
		Scanner keyboard = new Scanner(System.in);
		
		System.out.print("Please enter an x value for the center: ");
		int x = keyboard.nextInt();
		
		System.out.print("Please enter an y value for the center: ");
		int y = keyboard.nextInt();
		Point center = new Point(x, y);
		
		System.out.print("Please enter a radius: ");
		double radius = keyboard.nextDouble();
		
		Circle c = new Circle(center, radius);
		String option = new String();
		
		while(!option.equals("x"))
		{
			keyboard.nextLine();	// dummy to get rid of extra CRLF
			
			System.out.println("\nPlease enter an option:");
			System.out.println("a: for area");
			System.out.println("c: for circumference");
			System.out.println("i: to check if a point is inside the circle");
			System.out.println("n: to enter a new circle");
			System.out.println("x: to exit from the program");
			option = keyboard.nextLine();
			
			if(option.equals("a") || option.equals("A"))
			{
				System.out.println("The area of the circle is: " + c.area());
			}
			else if (option.equals("c") || option.equals("C"))
			{
				System.out.println("The circumference of the circle is: " + c.circumference());
			}
			else if (option.equals("i") || option.equals("I"))
			{
				System.out.print("Please enter an x value for a point: ");
				int x2 = keyboard.nextInt();
				
				System.out.print("Please enter an y value for a point: ");
				int y2 = keyboard.nextInt();
				Point p = new Point(x2, y2);
		
				if(c.isInside(p))
					System.out.println("The point is inside the circle");
				else
					System.out.println("The point is outside the circle");
			}
			else if (option.equals("n") || option.equals("N"))
			{
				System.out.print("Please enter an x value for the center: ");
				x = keyboard.nextInt();
				
				System.out.print("Please enter an y value for the center: ");
				y = keyboard.nextInt();
				center = new Point(x, y);
				
				System.out.print("Please enter a radius: ");
				radius = keyboard.nextDouble();
				
				c = new Circle(center, radius);
			}
			
		}
			
	}
	
}
		