Advertisement
dizzy94

Untitled

Apr 22nd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package geometria;
  2.  
  3. public class Kolo implements Figura{
  4. public double promien;
  5. public String nazwa;
  6. public Punkt punkt;
  7. final static double PI = 3.14159265359;
  8. public Kolo(double promien, double punktX, double punktY){
  9. this.nazwa = "kolo";
  10. this.promien = promien;
  11. this.punkt.wspolrzednaX = punktX;
  12. this.punkt.wspolrzednaY = punktY;
  13. }
  14. public double pole(){ return PI*promien*promien; };
  15. public double obwod(){return 2*PI*promien;};
  16.  
  17. @Override
  18. public String toString() {
  19. return ("Figura: "+ nazwa + punkt + " promień to : " + promien + " pole:" + pole() + " obówd: "+ obwod());
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement