Advertisement
Guest User

Ponit.java

a guest
Feb 26th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public abstract class Point {
  2.     private int x;
  3.     private int y;
  4.     private int z;
  5.  
  6.     public Point() {
  7.         x = 3;
  8.         y = 4;
  9.         z = 5;
  10.     }
  11.  
  12.     public Point(int x, int y, int z) {
  13.         setX(x);
  14.         setY(y);
  15.         setZ(z);
  16.     }
  17.  
  18.     public void setX(int x) {
  19.         this.x = x;
  20.     }
  21.  
  22.     public void setY(int y) {
  23.         this.y = y;
  24.     }
  25.  
  26.     public void setZ(int z) {
  27.         this.z = z;
  28.     }
  29.  
  30.     public int getX() {
  31.         return x;
  32.     }
  33.  
  34.     public int getY() {
  35.         return  y;
  36.     }
  37.  
  38.     public int getZ() {
  39.         return z;
  40.     }
  41.  
  42.     public String toString() {
  43.         return "(" + x + ", " + z + ", " + y + ")";
  44.     }
  45.  
  46.     public abstract int calcArea();
  47.     public abstract int calcVolume();
  48.     public abstract DrawFigure drawFigure();
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement