# AreaCalculator_Comments.py # # This program allows us to compute the area of # a triangle, a circle, a rectangle, a square and an ellipse. # # Anne Lavergne # June 2015 - Modified July 2017 # # Demonstrating "Incremental Development" # 1) We write a header comment block # 2) We copy and paste the low-level algorithm into our empty program. # The steps of this algorithm become our comments. # Print menu # Print description of program # Print menu displaying selection of shapes # Get options from user (+ validate input) # Print input instruction to user and read user input # Validate input # Based on option selected by user, get appropriate input from user (+ validate input) # If "triangle" is selected, then ask for the base and height # If "circle" is selected, then ask for the radius # if "rectangle" is selected, then ask for the width and height # if "square" is selected, then ask for one side # if "ellipse" is selected, then ask for both radii # Validate input # Compute desired area # If "triangle" is selected, then compute area = 0.5 ( base * height ) # If "circle" is selected, then compute area = pi * radius squared # if "rectangle" is selected, then compute area = width * height # if "square" is selected, then compute area = side squared # if "ellipse" is selected, then compute area = pi * radius1 * radius2 # Display result # Print the shape, the input data and the area