Created
October 9, 2017 23:16
-
-
Save Jatapiaro/7c8c76268e3a950ed857c826f64f4919 to your computer and use it in GitHub Desktop.
ejercicio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Circle{ | |
private double radius; | |
private String color; | |
public Circle(double radius, String color){ | |
this.radius = radius; | |
this.color = color; | |
} | |
public double getRadius(){ return this.radius; } | |
public void setRadius(double radius){this.radius = radius;} | |
public String getColor(){ return this.color; } | |
public void setRadius(String color){ this.color = color;} | |
@Override | |
public String toString(){ | |
return "Circle: { radious: "+this.radius+", color: "+this.color+"}"; | |
} | |
} | |
----------------------------- | |
public class Cylinder{ | |
public Circle base; | |
public double height; | |
public Cylinder(Circle base, double height){ | |
this.base = base; | |
this.height = height; | |
} | |
public Circle getBase(){ return this.base; } | |
public void setBase(Circle circle){this.base = circle;} | |
public double getHeight(){ return this.height; } | |
public void setHeight(double height){ this.height = height;} | |
@Override | |
public String toString(){ | |
return "Cylinder: { "+this.base+", height: "+this.height+" }"; | |
} | |
public static void main(String[] args) { | |
Cylinder c = new Cylinder( | |
new Circle(3, "Rosa Mexicano"), | |
10.5); | |
System.out.println(c); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment