Write a Python program that calculates the area and the circumferenceof a circle whose radius is described by the equation:r=√(x−h)2+(y−k)2+(z−m)2-------------------(1)Your code must have a main( ) and a getValues(center, point) functions.1.The main function reads data from an input file, which has theformat shown below. Each line in the file starts with a serialnumber followed by h, k, m, x, y, and then z (see Fig. 1). 2.For each sphere, the function getValues(center, point) receivestwo lists center (containing h,k, and m) and point (containing x,y, and z). Then it returns a list containing the radius, surfacearea and volume of the sphere use Equation 2 and 3 below. area=4πr2----------------------------(2)volume=43πr3----------------(3)3.This list is received by the main function and it is written it in an output file.4.In addition to that, your main function will count how many spheres have a surface areas less than 200 units2.Note: You program must be general and works for any number of experiments. All reading and writing must be done in the main function.   Sample input file below: (you can copy/paste and save below data as text file for input)1 9.07 4.09 4.84 5 7.19 3.42 2 5.585.519.341.028.611.4236.773.771.58.173.244.742.192.837.095.855.737.9555.860.189.163.912.69.11 Sample output file below:SnrAreaVolume15.31354.32627.1529.651170.213764.1833.53156.59184.2544.75283.53448.9253.11121.54126Number of circles with surface area less than 200 units sq = 3

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a Python program that calculates the area and the circumferenceof a circle whose radius is described by the equation:r=√(x−h)2+(y−k)2+(z−m)2-------------------(1)Your code must have a main( ) and a getValues(center, point) functions.1.The main function reads data from an input file, which has theformat shown below. Each line in the file starts with a serialnumber followed by h, k, m, x, y, and then z (see Fig. 1). 2.For each sphere, the function getValues(center, point) receivestwo lists center (containing h,k, and m) and point (containing x,y, and z). Then it returns a list containing the radius, surfacearea and volume of the sphere use Equation 2 and 3 below. area=4πr2----------------------------(2)volume=43πr3----------------(3)3.This list is received by the main function and it is written it in an output file.4.In addition to that, your main function will count how many spheres have a surface areas less than 200 units2.Note: You program must be general and works for any number of experiments. All reading and writing must be done in the main function.

 

Sample input file below: (you can copy/paste and save below data as text file for input)1 9.07 4.09 4.84 5 7.19 3.42 2 5.585.519.341.028.611.4236.773.771.58.173.244.742.192.837.095.855.737.9555.860.189.163.912.69.11

Sample output file below:SnrAreaVolume15.31354.32627.1529.651170.213764.1833.53156.59184.2544.75283.53448.9253.11121.54126Number of circles with surface area less than 200 units sq = 3

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY