Question: DESCRIPTION Complete the program to calculate and print the circumference and area of a circle, rounded to the nearest tenth (1 decimal place). The starter
DESCRIPTION Complete the program to calculate and print the circumference and area of a circle, rounded to the nearest tenth (1 decimal place). The starter code already prompts the user and takes in the radius as a double-value input. You need to do the calculations and print the results. I recommend using the printf() command (described in chapter 3 of the book) to print the results with the correct rounding.
Sample output:
Enter the radius of a circle in centimeters: 5
Circumference = 31.4 cm
Area = 78.5 cm^2
Started code
//Must use printf()
import java.util.Scanner;
class Circle {
static Scanner sc = new Scanner(System.in); public static void main(String args[]) { System.out.print("Enter radius of circle in centimeters:"); double radius = sc.nextDouble();
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
