#include <iostream>
using namespace std;

int main()

{
	int choice; 
	
	double area, r;//r is radius of the circle
	double PI=3.14159;
	double length,width;
	double base,height;

	cout<<"Geometry Calculator\n";
	cout<<"\n";
	cout<<"1. Calculate the Area of a Circle\n";
	cout<<"2. Calculate the Area of a Rectangle\n";
	cout<<"3. Calculate the Area of a Triangle\n";
	cout<<"4. Quit\n";
	cout<<"\n";
	
	cout<<"Enter your choice(1-4): ";
	cin>>choice;
	
	switch (choice)
	{
		case 1	: 	cout<<"What is the radius of the circle?\n";
					cin>>r;
					if (r>=0)
					{
					area= PI*r*r;
	 				cout<<"The area of the circle is "<<area<<endl;
	 		    	}
	 				else
	 				cout<<"Invalid value.Please enter positive number\n";
	 				break;
	 			
	 	case 2	: 	cout<<"What is the length and the width of the rectangle?\n";
	 				cin>>length>>width;
	 				if (length>=0&&width>=0)
	 				{
	 				area=length*width;
	 				cout<<"The area of the rectangle is "<<area<<endl;
					}
					else
					cout<<"Invalid value.Please enter positive number\n";
					break;
				 
		case 3	: 	cout<<"What is the base and the height of the triangle?\n";
	 				cin >> base>>height;
					if (base>=0&&height>=0)
					{
					area=base*height*.5;
	 				cout<<"The area of the triangle is "<<area<<endl;
					}
					else
					cout<<"Invalid value.Please enter positive number\n";
					break;
		
		case 4	: 	cout<<"Quit\n";
					break;
				
		default	: 	cout<<"Error choice.Please select from 1 to 4.\n";
					break;
	}
	
	return 0;
	
 } 
