Question
Topics: Branching, Looping, Import user_defined module, functions, docstring Problem Statement: Geometric Calculator In this BWA, we will be building a simple geometric calculator using user-defined
Topics: Branching, Looping, Import user_defined module, functions, docstring
Problem Statement: Geometric Calculator
In this BWA, we will be building a simple geometric calculator using user-defined functions and import module procedure. The user will have options to choose different shapes like triangle, circle, square, rectangle and what they want to calculate: for e.g. perimeter, area etc. The calculator will provide them the results according to the user choice. Apart from the usage of module and functions, this assignment also focuses on documenting the code. Therefore, your code should be well documented
with docstring, comments and pseudocode.
Lab scenario:
1. You will be writing a utility module named as firstname_lastname_BWA3_utility.py and an
application file named firstname_lastname_BWA3_application.py. The utility module will have all the basic functions for calculation and the application will contain the main functionality.
2. All the functions should start with a docstring and properly commented. The function name should be meaningful and short. The docstring will have the following format:
"""
Input: name of the input, data type
Return: return value, data type
"""
3. The variable name should be meaningful and valid.
4. There will be 3 menus for this assignment
1. The first menu will be the main menu.
2. The next menu will ask for the choice of geometric shape.
3. The last menu will then ask for the kind of calculation you want to perform on that shape and
will ask for the corresponding measurement based on type of operation.
For e.g.: If the user chooses to run the calculator then the second menu will be displayed which will ask for shape. If the user types 'triangle' for next choice and then the next menu will ask for the type of calculation for example: user inputs area, then the program should ask for the variables that are needed to calculate the area of a triangle. So the user will input base and height in this case.
5. The geometric shape that you will define are: circle, triangle, rectangle and square
6. The kind of operations that you will define are: area, perimeter (or circumference if its circle)
7. The menu options should reside in the application program and the calculation functions should be in the utility module or .py file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started