logo Hurry, Grab up to 30% discount on the entire course
Order Now logo
602 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Rashad SymonsPsychology
(5/5)

837 Answers

Hire Me
expert
Ashok GehlotComputer science
(5/5)

791 Answers

Hire Me
expert
Elyza Marice GamisManagement
(5/5)

546 Answers

Hire Me
expert
Piper SharpMathematics
(5/5)

503 Answers

Hire Me
Python Programming
(5/5)

Write a Python program called GeometryCalculator.py that begins by displaying a menu exactly as below:

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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...

 

 

(5/5)
Attachments:

Expert's Answer

602 Times Downloaded

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

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

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme