|
|
SO i have a question the questio is Design and implement a class called Cylinder that contains instance data that represents the cylinder’s radius and height. Define a Cylinder constructor to accept and initialize the radius and height, and include getter and setter methods for both instance variables. Include methods that calculate and return the volume and surface area of the cylinder (see preceding problem for formulas). Include a toString method that returns a one-line description of the cylinder. Create a driver class, called MultiCylinder, that instantiates and updates two Cylinder objects, printing their radius and height before and after modification, and prints the final volume and surface area of each cylinder. So far i have
public class Cylinder {
private int radius;
private int height;
private int h;
private int r;
/**
* Create a new Cylinder with height h and a base of radius r centered at (x,y).
*/
public Cylinder()
{
height = h;
radius = r;
}
public float getheight ()
{
return height;
}
public float getvolume()
{
radius=2;
return radius;
}
}
if someone could help me or guide me in the right direction i would really appreaciate that. Thank you