Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3: Circle Area Estimation Carefully read this entire document before beginning your work. 1 Objective In addition to what you have already used in

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Project 3: Circle Area Estimation Carefully read this entire document before beginning your work. 1 Objective In addition to what you have already used in projects, this project requires indefinite loops to do its work. You'll also get a chance to display information to the user and gather information from them. The project's subject matter ties in nicely with the math that you have studied. It will also test your ability to design your approach, develop incrementally, and test your code. 2 Background We're working with a circle with center (0,0). For examples in the handout we'll use a radius of 10. As you should remember from geometry, such a circle can be represented by the equation x2 + y2 = 102. (0,10) x + y2 = 102 (-10,0) (0,0) (10,0) (0,-10) To do our calculations we need a formula to find the y coordinate given an x coordinate. For example, when x = 5, y is calculated as y = V102 -52, or 8.66025. 3 Area Estimation The area of the circle can be estimated by using a series of n rectangles. We'll focus on quadrant I, then multiply to estimate the entire circle's area. Each of the rectangles starts at a calculated value of x, with a width specified by r (the radius divided by the number of rectangles) and the rectangle's left-side y determined by supplying the calculated x and determining y per the circle's equation.' Were we to visualize the estimation for four rectangles in our r=10 example), it would look like this: (0,10) (0,0) (10,0) In this example, rectangle width is 10 / 4 = 2.5. Here, then, are the rectangle calculations: Rectangle #1 Rectangle #2 Rectangle #3 Rectangle #4 Total X 0.0 2.5 5.0 7.5 ywidth area 10.00 2.5 25.00 9.68 2.5 24.21 8.66 2 .5 21.65 6.61 2.5 16.54 87.40 The circle's area is therefore estimated at 87.4 * 4 = 349.6. We know the actual area of the circle is calculated by the formula A = nr2, in this case 314.159. That means we've overestimated by 11.28%. The more rectangles we use, the closer we get to the actual area. It's expected that n is sometimes greater than r; for example, with 20 rectangles, the area is 322.8465, only 2.77% overestimated. This is called a Left Riemann Sum. Page 2 of 5 4 User Interface Display this menu: Circle Area Calculations Menu 1. Set radius 2. Find y values for a given x 3. Calculate actual area 4. Calculate estimated area 5. Exit the program Enter your choice: Keep the user within the menu system until they choose to exit, i.e., they can do more than activity while they are there. If the user enters an integer outside the range of valid menu choices, or enters an invalid data type, tell them they've made an error and make them try again. Here are more details about the menu choices: 1. Allows the user to set the radius for other calculations; must be a positive number (re-prompt, if not). 2. Asks user for an x coordinate (ensure the entry is 0

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions