Circle Calculation
Objective
To get more practice with using functions.Task
Your task is to write a program that will read in the radius of a circle, and print out the diameter, circumference and area.
Your program should use a separate function for doing each calculation, and should use parameters and return values to pass information back and forth.
The formulas are given below:
$diameter = 2 \times radius$
$area = \pi \times radius^2$
$circumference = 2 \times \pi \times radius$
Details
- Write the functions to do each calculation.
- Test that each one works.
- Write main to ask the user to enter the radius, then call each function, and print the results.
- $\pi$ is available in Java as Math.PI