Results 1 to 5 of 5
  1. #1
    Zompire is offline Member
    Join Date
    Jul 2016
    Posts
    8
    Rep Power
    0

    Default i am stuck an not sure what to do here calculations keep resulting in 0.0

    public class TurnerCylinder
    {
    public static class Cylinder extends
    {
    double radius;
    double height;
    double area = (2 * Math.PI * radius * height) + (2 * Math.PI *(radius * radius));
    double volume= height * Math.PI * radius * radius;
    public Cylinder(double radius, double height)
    {
    this.radius = radius;
    this.height = height;
    }
    public double getRadius()
    {
    return radius;
    }
    public void setRadius(double r)
    {
    radius = r;
    }
    public double getHeight()
    {
    return height;
    }
    public void setHeight(double h)
    {
    height = h;
    }
    public double getArea()
    {
    return area;
    }
    public double getVolume()
    {
    return volume;
    }
    public String toString()
    {
    return ("Cylinder radius is " + radius + " and the height is " + height + ". Cylinder Area is " + area + " and the volume is " + volume + ".");
    }
    }
    public static void main (String [] args)
    {

    Cylinder cylinder1 = new Cylinder(5.5, 7.8);

    System.out.println(cylinder1);
    cylinder1.setRadius(2.4);
    System.out.println(cylinder1);
    cylinder1.setHeight(10.9);
    System.out.println(cylinder1);
    }

    }

  2. #2
    Zompire is offline Member
    Join Date
    Jul 2016
    Posts
    8
    Rep Power
    0

    Default Re: i am stuck an not sure what to do here calculations keep resulting in 0.0

    forget the first line where it says extends i didnt mean to have that there

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: i am stuck an not sure what to do here calculations keep resulting in 0.0

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    Do you have a question?
    If the there are errors, copy the full text and paste it here.
    If the output is not what you want, copy the output, paste it here and add some comments saying what is wrong with it.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    Zompire is offline Member
    Join Date
    Jul 2016
    Posts
    8
    Rep Power
    0

    Default Re: i am stuck an not sure what to do here calculations keep resulting in 0.0

    sorry new to posting on threads i actually figured it out thank you tho

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: i am stuck an not sure what to do here calculations keep resulting in 0.0

    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 0
    Last Post: 09-24-2010, 11:03 AM

Tags for this Thread

Posting Permissions

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