Advertisement
sergAccount

Untitled

Jan 30th, 2021
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 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 javaapplication21;
  7.  
  8. import java.awt.Color;
  9.  
  10. public class Square {
  11.     // св-ва
  12.     int x; // точка в который будет находиться наша фигура
  13.     int y;
  14.     //
  15.     int a;  // длина стороны квадрата  
  16.     // св-во отвечает за цвет фигуры (квадрата)
  17.     Color color;
  18.     // конструктор класса
  19.     public Square(int x1, int y1, int a1){
  20.         x = x1;
  21.         y = y1;
  22.         a = a1;
  23.     }    
  24.      // конструктор класса
  25.     public Square(int x1, int y1, int a1, Color color1){
  26.         x = x1;
  27.         y = y1;
  28.         a = a1;
  29.         color = color1;
  30.     }
  31.    
  32.     // методы
  33.     // Alt + Insert
  34.     public int getX() {
  35.         return x;
  36.     }
  37.     public int getY() {
  38.         return y;
  39.     }
  40.     public int getA() {
  41.         return a;
  42.     }
  43.     // set-методы
  44.     public void setX(int x) {
  45.         this.x = x;
  46.     }
  47.     public void setY(int y) {
  48.         this.y = y;
  49.     }
  50.     // Alt + Insert
  51.     public Color getColor() {
  52.         return color;
  53.     }
  54.     public void setColor(Color color) {
  55.         this.color = color;
  56.     }
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement