Results 1 to 2 of 2
  1. #1
    luciawashaya is offline Member
    Join Date
    Oct 2011
    Rep Power

    Default this java programme has compiled but does it answer the qn

    efine a Java class called Circle with data fields for centre coordinate values , circle radius and circle area, where the area is given by Math.PI*radius*radius. The class also has a Circle constructor with arguments for the centre coordinate ( x,y) and radius. The class also has a public method for getting circle area. [8 marks
    class Circle{
    double x;
    double y;
    double radius;
    double area ;
    Circle(double a,double b,double c){
    x = a;
    y = b;
    radius = c;

    public double getArea(double d){
    return Math.PI*radius*radius;

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: this java programme has compiled but does it answer the qn

    You never use the global area variable. And why does your getArea() function take a parameter that you never use?
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. Replies: 3
    Last Post: 06-22-2011, 08:12 AM
  2. Compare true Answer /Player answer
    By Eilime in forum New To Java
    Replies: 1
    Last Post: 04-24-2011, 08:51 PM
  3. Replies: 3
    Last Post: 12-12-2008, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts