Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Courtney Coker
- public class Cone {
- private double radius;
- private double height;
- public Cone() {
- radius = 1;
- height = 1;
- }
- public Cone(double i, double j) {
- radius = i;
- height = j;
- }
- public double volume(){
- return (1.0/3) * (22/7.0) * (radius * radius) * height;
- }
- public double area(){
- return (22/7.0) * radius * (radius + Math.sqrt((height * height) + (radius * radius)));
- }
- public String toString(){
- return "The volume and area of this rectangle is volume = " + volume() +" area = " + area();
- }
- public void setVariables(double l, double w){
- radius = l;
- height = w;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement