I need to make this:
Design a Cylinder class that has radius and height attributes, a constructor with which the values of both attributes can be set, and the getRadio (), getHeight (), setRadio () and setHeight () methods. The class will also have the toString () method that will return a String that indicates the values of its attributes. Create two objects of class Cylinder (cylinderA and cylinderB). Display the content of the attributes of both objects. Then assign one object to the other and display the contents of both on the screen. Finally, modify the content of the attributes of one of the objects and display the content of the other. Explain in detail what happens throughout the program so that what happens with the pointers is clearly visible.
And I fully understand all until toString() method. After that I dont know how to code it. I will appreciate any help. I will paste the code I have below.
class Cilindro{ double radio; double altura; Cilindro() { radio = 10; altura = 20; } public double getRadio() { return radio; } public double getAltura() { return altura; } public void setRadio(double radio) { this.radio = radio; } public void setAltura(double altura) { this.altura = altura; } public String toString() { return ("Radio = " + radio + "\nAltura = " + altura); } }