Advertisement
sergAccount

Untitled

Nov 29th, 2020
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javaapp10;
  7.  
  8. public class Rectangle implements IShape{
  9.     // свойства
  10.     int x;
  11.     int y;
  12.     int w;
  13.     int h;
  14.     //
  15.     public Rectangle(int x1, int y1, int w1, int h1){
  16.         x = x1;
  17.         x = y1;
  18.         w = w1;
  19.         h = h1;
  20.     }        
  21.     // Создать метод который находит площадь прямоугольника на основе свойств данного класса.    
  22.     public int getAreaSize(){
  23.         return w * h;
  24.     }
  25.     // метода
  26.     @Override
  27.     public int getX() {
  28.         return x;
  29.     }
  30.     @Override
  31.     public int getY() {
  32.         return y;
  33.     }    
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement