1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import java.util.Scanner;
public class assignment4
{
	public static void main(String[] args)
	{
		mainMenu();
	}

public static void mainMenu()
{
	boolean flag = true;
	boolean checkOne = false;
	int option;
	double radius;
	Scanner keyboard = new Scanner(System.in);
	while (flag == true)
	{
	System.out.println("\nCircle");
	System.out.println("\n1.\tSet Radius");
	System.out.println("2.\tGet the Radius");
	System.out.println("3.\tCompute the Area of the circle");
	System.out.println("4.\tCompute the Diameter");
	System.out.println("5.\tCompute the Circumference");
	System.out.println("6.\tExit");
	System.out.print("\nSelect an option: ");
	option = keyboard.nextInt();
	
	Circle one = new Circle();
	
	switch(option)
	{
		case 1:
		System.out.print("Enter the radius: ");
		radius = keyboard.nextDouble();
		one.setRadius(radius);
		checkOne = true;
		break;
		
		case 2:
		if (checkOne == false)
			System.out.println("Error: Do option 1 first");
		else
		{
			System.out.println("The radius is " + one.getRadius());
		}
		break;
		
		case 3:
		if (checkOne == false)
			System.out.println("Error: Do option 1 first");
		else
		{
			System.out.println("The area is " + one.getArea());
		}
		break;
		
		case 4:
		if (checkOne == false)
			System.out.println("Error: Do option 1 first");
		else
		{
			System.out.println("The diameter is " + one.getDiameter());
		}
		break;
		
		case 5:
		if (checkOne == false)
			System.out.println("Error: Do option 1 first");
		else
		{
			System.out.println("The circumference is " + one.getCircumference());
		}
		break;
		
		case 6:
		System.out.println("Thanks for using the Circle - good Bye!");
		flag = false;
		break;
	}//switch
	
	}//while
}//mainMenu
}//end program