Question: Project # 4 2 D & 3 D Geometry Calculator 1 Problem Overview In a geometry class, you are studying interesting formulas for circles, squares,

Project #42D & 3D Geometry Calculator
1 Problem Overview
In a geometry class, you are studying interesting formulas for circles, squares, spheres, and cubes. You
are writing a program to encode those formulas and generate accurate results.
2 User Interface
2.1 Input
The program asks the user for a size (which will be used for radius and side length, depending on the
shape), and the unit of measure being used. Example:
Enter size for side and radius: 5
Enter unit of measure, e.g., inches: inches
2.2 Output
Displays an attractive and aligned report with all the results, as shown below. Note that the numbers here
are merely samples and are intentionally incorrect; you will need to figure out what is right here!
--------------------------------------------
Square Calculations
--------------------------------------------
Perimeter: 9.85 linear inches
Area: 17.91 square inches
--------------------------------------------
Cube Calculations
--------------------------------------------
Volume: 514.99 cubic inches
Surface area: 75.32 square inches
--------------------------------------------
Circle Calculations
--------------------------------------------
Circumference: 13.83 linear inches
Area: 29.22 square inches
--------------------------------------------
Sphere Calculations
--------------------------------------------
Volume: 146.25 cubic inches
Surface area: 83.11 square inches
CSC110 Intro to Programming with Python 10/9/2023
Page 2 of 4
3 Functions
3.1 Call Hierarchy
3.2 Function Specifications
3.2.1 Descriptions
Here is a brief description of what each function should do, and what file it should live in:
Function Description File
main Consists of a series of function calls and little else proj4.py
getInput Asks the user for (1) size and (2) unit of measure; returns those proj4.py
display* Prints a header line (e.g.,Square Calculations) and the results of
calculations for that object (e.g., all corresponding square calculations).
Each takes two parameters, a radius or side length (depending on the
context) and the unit of measure
proj4.py
square*,
cube*, circle*,
sphere*
Calculates and returns the specific results, e.g., CubeVolume calculates
the volume of a cube with the specified side length. Each takes a single
parameter, radius or side length depending on the context
p4geom.py
3.2.2 Parameters and Return Values
You need to determine the parameters and return values for each function. But here are some rules you
will need to follow in your quest:
There may be no global variables; you must pass data to functions to communicate it.
All functions that calculate geometry results must be in a module (a separate file) called
p4geom.py. The main program will need to import that module and use it.
The p4geom.py module must use the math modules pi variable. That means p4geom.py will need
to import the math module.
Watch the names of parameters and arguments; they should not always match as the sender and
receiver may interpret the data in slightly different ways. For example, getInput gathers a generic
size from the user, but circleArea clearly wants a circles radius as a parameter.
main
getInput displaySquareResults
squarePerim
squareArea
displayCubeResults
cubeVolume
cubeSurfArea
displayCircleResults
circleCircum
circleArea
displaySphereResults
sphereVolume
sphereSurfArea
proj4.py
p4geom.py
CSC110 Intro to Programming with Python 10/9/2023
Page 3 of 4
3.3 Calculations
The geometry calculations are standard ones:
Circle: = and =2
Sphere: =4/33 and =42
Square: =4 and =2
Cube: =3 and =62
Watch your units of measure and display the correct one, e.g., linear inches are different from square
inches or cubic inches. Think to make sure you have got it right.
4 Code Specifications
At the bottom of the program you should have a call to main().
Include header comments at the top of each file. Include your name, the date, and a brief
description of what the program does.
Include comments for each section saying what is going on in the lines of code below, e.g.,
# define circle functions
Use comments elsewhere as you think they help guide the reader. Do not overdo, though! Not
every line needs a comment; think about describing a block of related code.
Use blank lines to separate sections and provide visual breathing room.
Use descriptive variable names.
You are free to use more advanced techniques in Python if you have the knowledge, including,
but not limited to, decision structures, loops, functions, lists, etc. Please limit your use of external
libraries, beyond the math library. If you are wondering if an external library would be acceptable,
ask the professor.
5 Hints
Use exactly the call hierarchy shown above, e.g., main calls displaySquareResults which calls
squarePerim and squareArea. Do not chain functions to force execution order.
Carefully consider parameters for each function. Think about what that function ne

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!