Geometry Calculator
Write a Python program called GeometryCalculator.py that begins by displaying a menu exactly as below:
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice:
If “1” is selected, then the Triangle submenu is displayed. The area of a triangle can be calculated two ways.
If the tringle is a right triangle, the area would be Area = ½ * base * height.
If the triangle has three known sides, them Heron’s formula can be used. Heron’s formula is
where s = semi-perimeter or (a+b+c)/2, and a,b, and c are the three sides.
Create functions to display the main menu and the triangle sub menu and the rectangle sub menu. Create modules called triangle.py and rectangle.py that contain the different functions to calculate the areas. The program should continue to display the main menu in a loop until the quit option is selected. To exit the program, use the sys.exit(0) statement. Be sure to include import triangle, import rectangle, and import sys statements.
Please examine the following output from a sample run to determine how the menu functions are organized, and how your program should flow. You can refer to the sample program on page 266 in the textbook for some guidance. When completed, please place the three source files, GeometryCalculator.py, triangle.py, and rectangle.py in a folder named “Your Name PreLab05A. Then zip that folder and send the zipped file to me as an attachment in BlackBoard.
Here is a sample run:
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 1
TRIANGLE SUB MENU
1) Enter base and height
2) Enter 3 sides
3) Quit
Enter your choice: 1
Enter base and height: 3 4
The area is 6.0
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 1
TRIANGLE SUB MENU
1) Enter base and height
2) Enter 3 sides
3) Quit
Enter your choice: 2
Enter 3 sides: 2 3 4
The area is 2.9047375096555625
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 2
RECTANGLE SUB MENU
1) Enter the side of the square
2) Enter length and width
3) Quit
Enter your choice: 1
Enter a side: 4
The area is 16.0
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 2
RECTANGLE SUB MENU
1) Enter the side of the square
2) Enter length and width
3) Quit
Enter your choice: 2
Enter length and width: 3 4
The area is 12.0
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 4
Error: invalid selection.
MENU
1) Triangle Area
2) Rectangle Area
3) Quit
Enter your choice: 3
Exiting the program...
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme