Advertisement
pojler

Lab4

Oct 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1.  
  2. package rectangle;
  3.  
  4. public class Rectangle {
  5. private int height=0, width=0, field = 0;
  6. Rectangle(int h, int w)
  7. {
  8. height = h;
  9. width = w;
  10. field = h*w;
  11. }
  12. Rectangle(int a)
  13. {
  14. this(a,a);
  15. }
  16. int getHeight()
  17. {
  18. return height;
  19. }
  20. int getWidth()
  21. {
  22. return width;
  23. }
  24. int getField()
  25. {
  26. return field;
  27. }
  28. void setHeight(int a)
  29. {
  30. height = a;
  31. }
  32. void setWidth(int a)
  33. {
  34. width = a;
  35. }
  36.  
  37. void wypisz ()
  38.  
  39. {
  40. System.out.println("Height of rectangle is " + getHeight());
  41. System.out.println("Width of rectangle is " + getWidth());
  42. System.out.println("Field of rectangle is " + getField());
  43. }
  44. public static void main(String[] args)
  45. {
  46. Rectangle a[] =new Rectangle[7];
  47. a =
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement