IDNLearn.com connects you with a community of experts ready to answer your questions. Get the information you need from our community of experts, who provide detailed and trustworthy answers.

Unit 2: Lesson 6 - Coding Activity 1
Write code that takes input from the user for the radius (double) of a circle, and create a circle with that radius. The program should then print a sentence with the circumference and area of the circle. You should use the appropriate Circle methods to obtain the circumference and area of the circle rather than calculating these values yourself.

Sample run:

Enter the radius of the circle:
> 3
A circle with a radius 3.0 has a circumference of 18.84955592153876 and an area of 28.274333882308138
Hint: You can approach this problem by saving the double (radius) as a variable and then creating the Circle, or you can create the Circle and use methods from the Circle class to set the radius.

what i have already in java:
/* Lesson 6 Coding Activity Question 1 */

import java.util.Scanner;
import shapes.*;

public class U2_L6_Activity_One
{
public static void main(String[] args)
{

Scanner scan = new Scanner(System.in);

System.out.println("Enter radius: ");

double r = scan.nextDouble();

Circle c = new Circle(r);

double area = c.getArea();

r = c.getRadius();

c.setRadius(r*2);

area = c.getArea();

C = c.getCircumfrence();

System.out.println("A circle with a radius " + r + " has a circumference of " + C + " and an area of "+ area);

}
}
Keeps giving me an error for circumference.
Any help?