Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

circle.java - could someone help me please?

  Asked By: Sunil    Date: Mar 31    Category: Java    Views: 1183
  

ive just started programing and ive been set this task of drawing
a circle which reports its area and circumference. so far what ive
come up with but i think its hideously wrong. could anyone help me
by giving a few pointers? no sarcasm please, ive only started
programming a couple weeks ago.

so far: declare private integer variables, xposition, and yposition.
declare constant pi.

define constructor method, which takes three integer arguments and
stores them in the instance variables radius, x position and y
position.

define paint method, which takes a Graphics object as argument,
draws a circle object using fillOval method and reports the radius,
area and circumference of the circle

define method calculateArea which takes no arguments and returns the
calculated area

define method calculateCircumference which takes no arguments and
returns the calculated circumference.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jaspreet Kapoor     Answered On: Mar 31

circumference of a circle  = 2*3.1415*radius
area of a circle = 3.1415 * radius * radius

if u r looking for an algorithm to draw a circle, u
have to mail me again.

 
Answer #2    Answered By: Elaine Stevens     Answered On: Mar 31

think i have sorted the program now through extensive trial and
error.

 
Didn't find what you were looking for? Find more on circle.java - could someone help me please? Or get search suggestion and latest updates.




Tagged: