Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python Exercise# 3: Marks: 4 Write a program that displays the following menu: 1: Rectangle 2: Circle The program, then, reads the menu choice

In pythonimage text in transcribed

Exercise# 3: Marks: 4 Write a program that displays the following menu: 1: Rectangle 2: Circle The program, then, reads the menu choice and behaves according to the following table: Menu choice 1 2 Program behavior The program prompts for and reads the width and length of a rectangle. It then computes and displays the area the rectangle. Area=width*length The program prompts for and reads the radius r of a circle. It then computes and displays the circle. Area = nr 2 = 3.14159 math.pi The program displays the following error message : Error: Wrong menu choice and then terminates. Input other than 1, and 2 Note: Assume that the values read by the program for options 1, and 2 are in centimeters. For these options, your program must display appropriate units in the output as shown below. 1: Rectangle 2: Circle Enter your choice: 3 Wrong choice 1: Rectangle 2: Circle Enter your choice: 1 Enter width: 25.32 Enter length: 35.68 Rectangle area= 903.42 cm^2 1: Rectangle 2: Circle Enter your choice: 2 Enter radius: 24.89 Circle area= 1946.25 cm^2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions