/* Problem4
* Brandon Watkins
* 10/23/08
*
* This program prompts the user to input the center of a circle and a point ona circle. It then calculates the radius, diameter, circumference, and area.
*/
// Import Classes Uncomment as needed
import java.util.*;
import java.lang.*;
public class Problem4
{
static Scanner console = new Scanner(System.in);
// create scanner to obtain input from the command line
public static void main(String[] args)
{
//variable declaration
double x1;
double x2;
double y1;
double y2;
double distance;
//executable statements
// Prompts for first double and stores value in x1
System.out.print ("Enter the value for the first point on the circle: ");
x1 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in x2
System.out.print ("Enter the second point on the circle: ");
x2 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in y1
System.out.print ("Enter the third point on the circle: ");
y1 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in y2
System.out.print ("Enter the fourth point on the circle: ");
y2 = console.nextDouble();
System.out.println();
}
public static double distance (double x1, double x2, double y1, double y2)
{
double distance;
distance = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
return distance;
}
public static double radius (double x1, double x2, double y1, double y2)
{
double radius;
distance (double x1, double x2, double y1, double y2);
radius = distance;
return radius;
}
}
This is what I have so far. I am stuck hardcore on the radius and distance methods.
I have to make a program that out puts a circle's radious, area, and circumference when it is given the center and a point on the circle.
I have make and use these 5 methods:
a. distance: This method takes as its parameters four numbers that represent two points in the plane and returns the distance between them.
b. radius: This method takes as its parameters four numbers that represent the center and a point on the circle, calls the method distance to find the radius of the ricle, returns the circles radius
c. This method takes as its parameter a number that represents the radius of the circle and returns the circles circumference.
d. area: distance: This method takes as its parameters a number that represents the radius of a circle and returns the circles area.
e. Use the named constant PI from the math class to specifi the value of pi
I am getting these errors. I am a complete noob and am lost. I have been working on this for hours.
6 errors found:
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: '.class' expected
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: ';' expected
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: <identifier> expected
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: not a statement
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: ';' expected
File: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java [line: 70]
Error: C:\Users\Brandon\Documents\Dr Java\Week4\Problem4.java:70: ';' expected
Please help me
This post has been edited by bwat47: 23 September 2008 - 07:07 PM

New Topic/Question
Reply




MultiQuote




|