While I am learning Java, I am having a small problem trying to solve a problem. I hope someone can help me:
I am required to develop a small program to calculate the Area of an Annulus
I have written down my thoughts about this problem.
An annulus can be thought of as two concentric circles (They are drawn with a common centre point). To determine the area of the annulus all I need to do is subtract the area of the smaller circle from the larger circle.
To determine the area of a circle, I will need the radius (or divide the diameter by 2). Then it's simply a matter of good old TTr2 (pi * (radius * radius)) to determine the area.
Eg. Lets say we are told that the diameter of the inner edge of the annulus is 10, and the diameter of the outer edge of the annulus is 15 :
For the sake of argument I will round TT to 3.14159
Area of first circle:
Radius = diameter/2 = 5
Area = TTr2 = 3.14159 * ( 5 * 5 ) = 78.53975
Area of second circle:
Radius = diameter/2 = 7.5
Area = TTr2 = 3.14159 * ( 7.5 * 7.5 ) = 176.7144375
Area = Area of large circle – Area of small circle
Area = 176.7144375 – 78.53975 = 98.1746875
At this stage, I am still unsure how to write a Java program but I must say that it's my first time learning this! Can anyone help me please?