Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public class Sikidom
  2. {
  3.     int csusokSzama;
  4.    
  5.     abstract double getKerulet();
  6.     abstract double getTerulet();
  7.    
  8.     public String toString()
  9.     {
  10.         return ""+ csucsokSzama + "szög, T: " + getTerulet() + ", K: " + getKerulet();
  11.     }
  12. }
  13.  
  14. public class Haromszog extends Sikidom
  15. {
  16.     double oldalA;
  17.     double oldalB;
  18.     double oldalC;
  19.  
  20.     double getTerulet()
  21.     {
  22.         return mittomenhogyszamolom;
  23.     }
  24.    
  25.     double getKerulet()
  26.     {
  27.         return oldalA + oldalB + oldalC;
  28.     }
  29.    
  30. }
  31.  
  32. public class Negyzet extends Sikidom
  33. {
  34.     double oldal;
  35.    
  36.     double getTerulet()
  37.     {
  38.         return a*a;
  39.     }
  40.    
  41.     double getKerulet()
  42.     {
  43.         return 4*a;
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement