Advertisement
rupek1995

TROJKATY MAIN JAVA ZIOMEK

Mar 15th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. package main;
  2.  
  3. import figury.Prostokat;
  4. import figury.Kolo;
  5. import figury.Trojkat;
  6.  
  7. public class Testowa {
  8.     public static void main(String[] args) {
  9.         Prostokat p1;
  10.         Prostokat p2;
  11.         Kolo k1;
  12.         Kolo k2;
  13.         Trojkat t1;
  14.         Trojkat t2;
  15.        
  16.         //Tworzenie prostokatow
  17.         p1 = new Prostokat();
  18.         p2 = new Prostokat(0, 0, 2, 0, 2, 2, 0, 2);
  19.         k1 = new Kolo();
  20.         k2 = new Kolo(2,2,5);
  21.         t1 = new Trojkat();
  22.         t2 = new Trojkat (-2,4,6,2,0,-5);
  23.         //Obliczenie pola
  24.         System.out.println("Pole p1 to: " + p1.podajPole());
  25.         System.out.println("Pole p2 to: " + p2.podajPole());
  26.         System.out.println("Pole k1 to: " + k1.podajPole());
  27.         System.out.println("Pole k2 to: " + k2.podajPole());
  28.         System.out.println("Pole t1 to: " + t1.podajPole());
  29.         System.out.println("Pole t2 to: " + t2.podajPole());
  30.        
  31.         //Wyrysowanie figur
  32.         p1.rysuj();
  33.         p2.rysuj();
  34.         k1.rysuj();
  35.         k2.rysuj();
  36.         t1.rysuj();
  37.         t2.rysuj();
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement