Write a Python program that calculates the area and the circumference of a circle whose radius is described by the equation: r=√(x−h)2+(y−k)2 Your code must have a main( ) and a getValues(center, point) functions.     The main function reads data from an input file, which has the format shown below. Each line in the file starts with a serial number followed by h, k, x, and then y (see Fig. 1). For each circle, the function getValues(center, point) receives two lists center (containing h and k) and point (containing x and y). Then it returns a list containing the radius, area and circumference of the circle use Equation 1 and 2 below. area= π r2 ----------------------------(1) circumference=2 π r ----------------(2)   This list is received by the main function and it is written it in an output file. In addition to that, your main function will count how many circles have a circumference less than 50. Note: You program must be general and works for any number of experiments. All reading and writing must be done in the main function. Please include the file names in the program and no need to ask the user for file names. Sample input file below: (you can copy/paste and save below data as text file for input) 1            4.64      1.74      7.83      0.12 2            4.76      1.45      7.1        3.36 3            5.61      1.83      5.76      2.25 4            0.58      9.44      6.89      2.61 5            0.2        4.08      4.53      5.88   Sample output file below:   Sn       Radius     Area         Circumference 1            3.58      40.26            22.49 2            xxxx       xxxx               xxxx 3            xxxx       xxxx                xxxx 4            xxxx       xxxx               xxxx 5            xxxx       xxxx               xxxx Number of circles with Circumference less than 50 units = 4

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

 

Write a Python program that calculates the area and the circumference of a circle whose radius is described by the equation: r=√(x−h)2+(y−k)2 Your code must have a main( ) and a getValues(center, point) functions.

 

 
  1. The main function reads data from an input file, which has the format shown below. Each line in the file starts with a serial number followed by h, k, x, and then y (see Fig. 1).
  2. For each circle, the function getValues(center, point) receives two lists center (containing h and k) and point (containing x and y). Then it returns a list containing the radius, area and circumference of the circle use Equation 1 and 2 below.

area= π r2 ----------------------------(1)

circumference=2 π r ----------------(2)

 

  1. This list is received by the main function and it is written it in an output file.
  2. In addition to that, your main function will count how many circles have a circumference less than 50.

Note:

You program must be general and works for any number of experiments.

All reading and writing must be done in the main function.

Please include the file names in the program and no need to ask the user for file names.

Sample input file below: (you can copy/paste and save below data as text file for input)

1            4.64      1.74      7.83      0.12

2            4.76      1.45      7.1        3.36

3            5.61      1.83      5.76      2.25

4            0.58      9.44      6.89      2.61

5            0.2        4.08      4.53      5.88

 

Sample output file below:

 

Sn       Radius     Area         Circumference

1            3.58      40.26            22.49

2            xxxx       xxxx               xxxx

3            xxxx       xxxx                xxxx

4            xxxx       xxxx               xxxx

5            xxxx       xxxx               xxxx

Number of circles with Circumference less than 50 units = 4

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education