CSci 151                                                             Spring 2015


                  Assignment 5:  Programmer-defined Functions

                             
Instructions
   Develop a menu-driven application to invoke functions for finding the area of
   a circle, a cylinder, a rectangle, a sphere, or a triangle according to the 
   problem specifications and design constraints specified below. Use your 
   leoMail username as the source file name(e.g. gPolya.cpp). Attach that file
   to an email sent to tom.brown at the domain named tamuc.edu on or before the 
   end of Tuesday 7 April. The email "subject" is to include our course code(151),
   your leoMail name without the domain name, and the assignment number.
   
Input
   Provide a menu of choices to enter for a circle, cylinder, rectangle, sphere,
   or triangle shape. Input the radius if the choice is to compute the area of a
   circle, cylinder, or sphere (also enter the height), if rectangle then input
   length and width; and if triangle input the base and height.

Processing
   The area of a circle is computed by PI(3.14) times radius squared (r * r);
   a cylinder is (2 * PI * radius squared) + (height * 2 * PI * radius); a 
   rectangle is length * width; a sphere is 4 * PI * radius squared; and area
   of a triangle is 0.5 * base * height.
   
Output
   Output a descriptive program title before input prompts. Then, output a line
   with: a description for the shape(e.g. Circle), formula(e.g. PI * r * r), 
   and the area computed.

Design and Style Constraints
1. Insert a block comment at the top of your source program with your LeoMail 
   name, our course code, and the assignment number. Also insert one or more 
   line comments.
2. Create descriptive identifier names, apply conventional notation (variables
   and function names in camelCase and constants(e.g. PI) in ALL_CAPS); and 
   initialize identifiers according to data type and reasonable value. Indent
   and align statements for readability and to show hierarchy.
3. Construct value-returning functions for processing each shape. Also, define
   a void function for printing results with parameters for shape, formula
   and area computed.
4. Use a multiway selection statement to test the shape code entered, then 
   invoke the corresponding user-defined function to accept dimension(s) and
   compute area. Should the user request to compute the area of an undefined
   shape, output an exception message.
5. Have an event-controlled repetition structure for continuing the entire
   process of computing an area until the user enters a value signaling 
   termination(e.g. exit code).   
  
Notes:
1. Online resources and our Webpage contain links to program examples that 
   apply to this lab. It is recommended that you analyze and test these.
2. No modifications will be made to eliminate syntax errors.
3. Though this assignment is quite similar to assignment 3, to earn credit 
   for assignment 5 the additional design and style constraints must be met.