Question: QUESTION:9 Python Programming Questions 1. Write a program that displays a menu with 6 different choices. Hint: You may use Named Constants for menu items.


QUESTION:9 Python Programming Questions 1. Write a program that displays a menu with 6 different choices. Hint: You may use Named Constants for menu items. PI = 3.14159 displayMenu function: MENU 1. Area of a circle 2. Diameter of a circle 3. Circumference of a circle 4. Area of a rectangle 5. Perimeter of a rectangle 6. Quit Depending on the selection, if the choice is circle: the program prompts user for radius of a circle. rectangle: the program prompts user for length and width. The program should display with appropriate labels, if the choice is: circle: radius, area, diameter and circumference rectangle: length, width, area and perimeter. Write the following functions: i. getRadius(): function prompts user for a radius of a circle. Returns the radius to the caller. Test input- do not accept negative numbers. Display invalid input message. ii. calcCircleArea(r): function receives a parameter, computes and returns area to the caller circArea = PI * radius * radius iii. calcCircleDiameter(r): function receives a parameter, computes and returns diameter to the caller diameter = radius * 2 iv. calcCircleCircumference(r): function receives a parameter, computes and returns circumference to the caller circumference = 2* PI* radius V getLenth(): function prompts user for length. Returns the length to the caller. Test input- do not accept negative numbers. Display invalid input message. getWidth(): function prompts user for width. Returns width to the caller vi. Test input- do not accept negative numbers. Display invalid input message. vii. calcRectangleArea(len, w): function receives two parameters, computes and returns area to the caller rectArea = len* w viii. calcRectanglePerimeter(len, w): function receives two parameters, computes and returns perimeter to the caller recPerimeter = 2 * len + 2* w or 2 * (len + w) ix displayCircleData(radius, area, diameter, circumference): function receives the 4 parameters and outputs data x displayRectangleData(length, width, area, perimeter): function receives the 4 parameters and outputs data Submit: Algorithm, Python code with documentation, Output Test Data: radius = 10 length = 15 width = 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
