I am doing an assignment that is asking for the user to put in the radius of a circle and the program figures out the area, diameter and circumference. It is using 2 different java programs to accomplish this. One with the info on how to get area, diameter and circumference and one is the demo that runs the program. I keep getting errors on my demo.
That is the first part and the second is:// Circle Class public class Circle { private double rad; private double Pie; private double area; private double diameter; private double circumference; public Circle(double Radius, double PI, double Area, double Diameter, double Circumference) { Radius = rad; PI = Pie; Pie =3.14159; Area = area; Diameter = diameter; Circumference = circumference; }
import java.util.Scanner; // Circle Demo public class CircleDemo { public static void main(String [] args) { System.out.println("Rich Simmerman 3/4/2014/n/n"); double circleRadius; Scanner keyboard = new Scanner(System.in); System.out.println("Enter the radius of the circle: "); circleRadius = keyboard.nextDouble(); [I] Circle data = new Circle(circleRadius);[/I] System.out.println("The circle's area is " + data.getArea()); System.out.println("The circle's diameter is " + data.getDiameter()); System.out.println("The circle's circumference is " + data.getCircumference()); } }
I am really just starting out and not sure what I'm doing.