Create a class named Circle to store the data about this circle. This class should contain these constructors and methods:
public Circle(double radius) public double getCircumference() public String getFormattedCircumference() public double getArea() public String getFormattedArea() private String formatNumber(double x) public static int getObjectCount()
The formulas for calculating circumference and area are:
circumference = 2 * pi * radius area = pi * radius2
For the value of pi, use the PI constant of the java.lang.Math class.
Create a class named CircleApp that gets the user input, creates a Circle object, and displays the circumference and area.
Create a class named Validator like the one shown in chapter 6 and use its static methods to validate the data in this application.
here is my project so far
import java.util.Scanner;
import java.text.NumberFormat;
/**
* @author Braber01
* DATE: September 3, 2010
* DESC: Get Area and Circumference of a Circle using OOP Methods
* and using good class Design
*/
public class Circle {
static int numObjects=0;
private double circumfrence;
private double area;
/**
* @param args The command Line Arguments
*/
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Welcome to Ben's Circle Tester");
System.out.println();
System.out.println("Enter Raidus: ");
double radius = in.nextDouble();
new Circle(radius);
}
public Circle(double radius){
//Circle.numObjects++;
}
public double getCircumference(){
return circumfrence;
}
public String getFormattedCircumference(){
return "";
}
public double getArea(){
return (double) 0;
}
public String getFormattedArea(){
return "";
}
@SuppressWarnings("unused")
private String formatNumber(double x){
return "";
}
public static int getObjectCount(){
return 0;
}
@SuppressWarnings("unused")
private class Validator{
}
}
Any help would be greatly appracated Thanks Braber01

New Topic/Question
Reply



MultiQuote





|