Advertisement
Guest User

flat_geometric_shape.java

a guest
Oct 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. package com.company;
  2.  
  3. /**
  4.  * Created by admin on 23.10.2018.
  5.  */
  6. public class flat_geometric_shape {
  7.     protected String nameFigure;
  8.     protected double S;
  9.     protected double P;
  10.  
  11.     public flat_geometric_shape()
  12.     {
  13.         S = 0.00;
  14.         P = 0.00;
  15.         this.nameFigure = new String("");
  16.     }
  17.  
  18.     public flat_geometric_shape(String nameFigure) throws IllegalArgumentException
  19.     {
  20.         if(nameFigure.equals(""))
  21.             throw new IllegalArgumentException("Нет имени у фигуры");
  22.         S = 0.00;
  23.         P = 0.00;
  24.         this.nameFigure = new String(nameFigure);
  25.     }
  26.  
  27.     public double getS()
  28.     {
  29.         return S;
  30.     }
  31.  
  32.     public double getP()
  33.     {
  34.         return P;
  35.     }
  36.  
  37.     public void P()
  38.     {
  39.         P = 0.0;
  40.     }
  41.  
  42.     public void S()
  43.     {
  44.         S = 0.00;
  45.     }
  46.  
  47.     public void setNameFigure(String nameFigure) throws IllegalArgumentException
  48.     {
  49.         if(nameFigure.equals(""))
  50.             throw new IllegalArgumentException("Нет имени у фигуры");
  51.         this.nameFigure = nameFigure;
  52.     }
  53.  
  54.     public String getNameFigure()
  55.     {
  56.         return this.nameFigure;
  57.     }
  58.  
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement