CGS2423 Assignment 4

Due 3/28 at the start of class

Create a program that does the following.

Create and use a function named intro that explains what your program does.

Create a function named menu that displays the following:

	Calculating PI
	
	(1) Specify the number of terms
	(2) Specify the precision
	(3) Exit
	
	Make a menu selection: 

Call the menu function and then read a value from the user. Validate that the number is between 1 and 3. If it is not in this range, then tell the user the input was incorrect, and read a new value. Continue this process until a valid number is entered. You must also handle the case if a character is entered instead of a number.

In options (1) and (2), the value of PI will be calculated using the formula in question 2 on page 227 of the text.

If option (3) is chosen, then display three totals: the number of times that option (1) was called, the number of times that option (2) was called, and the number of times that an incorrect menu option was entered.

Repeat the process of displaying the menu, reading an option from the user, and performing the task for that option, until the user enters option 3. Only display the introduction once.