Advertisement
kalin729

Kursova Circle

Jan 5th, 2018 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. package zad1;
  2.  
  3. public class Circle {
  4.  
  5.     private int r = 0;
  6.     private String color = "";
  7.     static private int count = 0;
  8.    
  9.     Circle(){
  10.         this.r = 0;
  11.         this.color = "";
  12.         count++;
  13.     }
  14.    
  15.     Circle(int radius){
  16.         this.r = radius;
  17.         this.color = "Trans-parent";
  18.         count++;
  19.     }
  20.    
  21.     Circle(int radius, String setColor){
  22.         this.r = radius;
  23.         this.color = setColor;
  24.         count++;
  25.     }
  26.    
  27.     void setRadius(int setRadius) {
  28.         this.r = setRadius;
  29.     }
  30.    
  31.     int getRadius() {
  32.         return this.r;
  33.     }
  34.    
  35.     void setColor(String setColor) {
  36.         this.color = setColor;
  37.     }
  38.    
  39.     String getColor() {
  40.         return this.color;
  41.     }
  42.    
  43.     double getArea() {
  44.         double Area = Math.PI*(Math.pow(r, 2));
  45.         return Area;
  46.     }
  47.    
  48.     int getCount() {
  49.         return count;
  50.     }
  51.    
  52.    
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement