## Question

Create a series of small programs each performing a calculation. Name each program the shape, followed by “-“, followed by the type of calculations (examples triangle-area.py, rectangularprism-volume.py). Each program should first display a message stating what the program does. This can reduce confusion if the student runs the wrong program.

For each variable in the equation ask the user to enter a value. Since these are students don’t just give them just the variable letter (like r); tell them the name of the variable also (like radius). If a variable appears many times in an equation only ask the user once for it.

Your programs need to perform the correct calculation and output the correct equation and the answer.

Here is some sample runs.

Sample 1

Assume user runs square-area.py

This program will compute the area of a square.

Enter the length of one of the sides of the square (a)?

>> 3

The equation for the area of a square is (area = a^2).

Your square has an area of 9

Sample 2

Assume user runs squarepyramid-volume.py

This program will compute the volume of a square pyramid.

Enter the area of the base of the pyramid (B)?

>> 5

Enter the height of the pyramid (h)?

>> 2

The equation for the volume of a square pyramid is (volume = 1/3 * B * h).

Your square has an area of 3.33333333

Write a small program for each of the shape and type of equations.

Shape Type

Square Area

Triangle Area

Rectangle Area

Trapezoid Area

Circle Area

Rectangular prism Volume

Right circular cylinder Volume

Square pyramid Volume

Right circular cone Volume

Sphere Volume

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

# square-area.pyprint("This program will comopute the area a square.")

w = input("Enter the length of width/height of the square (w)? ")

w = float(w)

print("The equation for the area of a square is \n area = w*w. ")

print("Your square has a area of " + str(w*w))...

By purchasing this solution you'll be able to access the following files:

Solution.docx and Solution.zip.