+ 1

# Area of a Circle (End of Module)

I've just made it to the end of the module and I've been lumped with a problem to solve that (so far as I can tell) not a single part of first section of this course has prepared me for. Is there something I am missing? Where on the first part of this course is this severe a degree (at least for me) of mathematical knowledge taught?

12 Answers

+ 3

Radius, diameter, PI, and ² are all mathematics and knowledge that should be learned in school. These are not programming terms. I'll try to explain what I can about them.
Diameter is the distance from one edge of a circle to the direct opposite edge of the circle, so that the line goes directly through the center point of the circle.
Radius is half the diameter, or the distance from the center point of a circle to its edge.
² is an exponent, meaning multiply the number by itself that many times. Where 5² = 5 * 5 = 25 or 5³ = 5 * 5 * 5 = 125
So in the case of finding the area of a circle you would multiply the Radius by itself, so, where r would represent the radius, r² = r * r
I'm not going to attempt to explain PI. Just know that it is a number that represents the constant ratio to be multiplied by to get the area. It is often rounded to 3.14
https://en.m.wikipedia.org/wiki/Pi
I suggest that you review the course to see how to get the input, do the conversion, and output the calculation.
lessons 4.1-9.1

+ 3

I get it, almost 30 yrs ago for me. Remember, Google is your friend if you need info for terms, formulas etc. 😉

+ 2

Martin Bodger
This is all the program is asking you to do;
"Complete the program to take the radius as input, then calculate and output the area of the circle."
The rest is just info to help accomplish this task.
You can review each part of this question, as all the info is in the course up to this point. Some of the code was provided for you (don't alter it). Use what has been provided and attempt to complete the remaining portion of the task. Once you have tried to code, if you were not successful in finding the solution, post your current code and define the issue you're having.
Note: none of what I stated previously was meant as a dig. I'm just trying to understand where you are having issues in your understanding to better help you, but sometimes things may not read as intended.

+ 1

The formula to find the area of a circle is given to you in the description of the problem. 'πr²' Pi * R² The value of Pi is also provided for you in the code. All you need to do is get the radius 'R' and output the result of PI * R * R

+ 1

What part do you not understand? It's just basic multiplication.

+ 1

School was 20 something years ago for me.
No need to explain Pi, I'm sure theres a video on it somewhere.
Bur your explanation is much clearer for me now. Thank you.

+ 1

Waldemar Urbański
Yes, you need to write your code so it passes all code coach test cases at the same time when run.

0

I'm sure that's the answer but I'd rather understand what I'm doing first.

0

I don't understand what it's asking me to do. It might seem "Basic" to some but to me this looks too complex for an entry level test.

0

We are going to write a program that will calculate the area of a circle.
- Calculate the area of a circle, complex but I'll try.
The area enclosed by a circle of radius r is πr², where π (pi) is the constant ratio of the circumference of any circle to its diameter, and r is the radius.
- Radius r? I don't understand what the superscript 2 is for above the Pi symbol. Constant ratio, what is that? To its diameter? The explanation here is too murky to understand for me, a beginner.
The given program declares a constant pi variable with a value of 3.14.
- I can see that.
Complete the program to take the radius as input, then calculate and output the area of the circle.
- Take the radius as input how? Have the user type it out or assign it to a variable, what? Calculate and output the area, so a write line code that displays a variable.
Sample Input
5
- No idea what this is.
Sample Output
78.5
- Nor any idea what this either.

0

Do all "test cases" have to be green? I calculate "test case 1" and I have passed it. When I enter data from "test case 2", passes this case but fails "test case 1"?

0

Thanks, ChaoticDawg. I understand.