Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. Courtney Coker
  2. public class Cone {
  3.     private double radius;
  4.     private double height;
  5.    
  6.     public Cone() {
  7.         radius = 1;
  8.         height = 1;
  9.     }
  10.    
  11.    
  12.     public Cone(double i, double j) {
  13.         radius = i;
  14.         height = j;
  15.     }
  16.    
  17.    
  18.    
  19.         public double volume(){
  20.         return (1.0/3) * (22/7.0) * (radius * radius) * height;
  21.     }
  22.         public  double area(){
  23.         return (22/7.0) * radius * (radius + Math.sqrt((height * height) + (radius * radius)));
  24.     }
  25.         public  String toString(){
  26.         return "The volume and area of this rectangle is volume = " + volume() +" area = " + area();
  27.     }
  28.         public void setVariables(double l, double w){
  29.         radius = l;
  30.         height = w;
  31.     }
  32.        
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement