Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the codes exactly as you would have typed it in Python (or in Notepad); simple, plain, and straightforward! Thank you! IT 280 -

Please write the codes exactly as you would have typed it in Python (or in Notepad); simple, plain, and straightforward! Thank you!

image text in transcribed

IT 280 - Lab \#3: Selection of Mathematical Functions Instructions To Submit This Program - In IDLE, choose File NewFile. - Type your program in the window that pops up, saving it as you work. - File name should be your Last Name followed by Lab 2.2 (Example: Fife Lab 2.2.py). .py is the automatic extension for a Python program. - Test the program by running it (F5 or Run Run Module) If you work on the program at different times, just load it into IDLE with: File Open. - When completed, submit the .py file you created. Program Inputs: - The user will be given 5 mathematical functions and will be asked for the appropriate inputs based on their selection: 1. Calculate the area of a circle given the diameter. 2. Calculate the MPG for a vehicle when provided the distance traveled and the amount of fuel used. 3. Calculate the total number of hours worked in a week when provided the hours worked each day of the week. 4. Calculate the perimeter of a rectangle when provided the length and width of one side of the rectangle. 5. Calculate the area of a rectangle when provided the length and width of one side of the rectangle. Program Processing: - Using the choice of function to perform and the required input(s), a function will be called to calculate the results. The result will be returned to the main program. Program Output: - The results of the calculation with appropriate text will be printed. If there are errors in any of the inputs, appropriate messages will be printed. - Correct this phyton code so that it performs the task outlined above. \# mathematical function import random import os def main(): print("Choose a mathematical function:") print("1. Calculate the area of a circle given the diameter") print("2. Calculate the MPG for a vehicle") print("3. Calculate the total number of hours worked in a week") print("4. Calculate the perimeter of a rectangle given the length and width") print("5. Calculate the area of a rectangle given the length and width") choice = get_int("Enter an integer:"); if choice =- 1 : def calculate_circle_area(): calculate_circle_area() elif choice ==2 : def calculate_mpg(): calculate_mpg() elif choice ==3 : def calculate_total_hours_worked(): calculate_total_hours_worked() elif choice ==4 : def calculate_rectangle_perimeter(): calculate_rectangle_perimeter() elif choice =5 : def calculate_rectangle_area(): calculate_rectangle_area() else: print("Invalid choice. Please try again.")

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions