Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class daneProstokata
  3. {
  4.  
  5. int a,b;
  6. Scanner odczyt = new Scanner(System.in);
  7.  
  8. void ustawBokA()
  9. {
  10. System.out.println("Podaj bok a");
  11. a = odczyt.nextInt();
  12. }
  13.  
  14. void ustawBokB()
  15. {
  16. System.out.println("Podaj bok b");
  17. b = odczyt.nextInt();
  18. }
  19.  
  20. int pobierzA()
  21. {return a;}
  22.  
  23. int pobierzB()
  24. {return b;}
  25.  
  26. int pole(int x, int y)
  27. {return x*y;}
  28.  
  29. int obwod(int x, int y)
  30. {return (2*x)+(2*y);}
  31.  
  32. }
  33.  
  34. public class Prostakat
  35. {
  36. public static void main(String[] args)
  37. {
  38. daneProstokata fin = new daneProstokata();
  39. fin.ustawBokA();
  40. fin.ustawBokB();
  41. System.out.println("a= " + fin.pobierzA());
  42. System.out.println("b= " + fin.pobierzB());
  43. System.out.println("Pole= " + fin.pole(fin.pobierzA(),fin.pobierzB()));
  44. System.out.println("Pole= " + fin.obwod(fin.pobierzA(),fin.pobierzB()));
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement