Exercise A5
Java Fundamentals exercises
Wk2 – Ex A5
- Write a program called Circle. Ask the user for the radius. Given the radius, calculate the diameter, circumference and the area (Google the formulae). Use constants where appropriate. Note that constants are declared with the keyword final preceding the type and the identifier is all capitals (good practice) i.e. final double PI = 3.14;
Console Output:
Enter radius: 5
The diameter is 10.0
The circumference is 31.400000000000002
The area is 78.5