STANAANDREY

polygons

Oct 3rd, 2025
253
0
Never
9
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. class Point {
  2.     private float x;
  3.     private float y;
  4.  
  5.     public Point(float x, float y) {
  6.         changeCoords(x, y);
  7.     }
  8.  
  9.     public void changeCoords(float x, float y) {
  10.         this.x = x;
  11.         this.y = y;
  12.     }
  13.  
  14.     @Override
  15.     public String toString() {
  16.         return "(" + x + ", " + y + ")";
  17.     }
  18. }
  19.  
  20. class Polygon {
  21.     private final Point[] points;
  22.  
  23.     public Polygon(int n) {
  24.         points = new Point[n];
  25.         for (int i = 0; i < n; i++) {
  26.             points[i] = new Point(0, 0);
  27.         }
  28.     }
  29.  
  30.     public Polygon(float[] coords) {
  31.         if (coords.length % 2 != 0) {
  32.             throw new IllegalArgumentException("len is odd");
  33.         }
  34.         int n = coords.length / 2;
  35.         this(n);
  36.         for (int i = 0; i < n; i++) {
  37.             points[i] = new Point(coords[2 * i], coords[2 * i + 1]);
  38.         }
  39.     }
  40.  
  41.     @Override
  42.     public String toString() {
  43.         StringBuilder sb = new StringBuilder("Polygon: ");
  44.         for (Point p : points) {
  45.             sb.append(p.toString()).append(" ");
  46.         }
  47.         return sb.toString();
  48.     }
  49. }
  50.  
  51. public class Main {
  52.     public static void main(String[] args) {
  53.         Polygon poly1 = new Polygon(3);
  54.         System.out.println(poly1);
  55.  
  56.         float[] coords = {0, 0, 1, 0, 1, 1, 0, 1};
  57.         Polygon poly2 = new Polygon(coords);
  58.         System.out.println(poly2);
  59.     }
  60. }
  61.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Azqexog
    25 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • Isgolye
    15 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • Nexkimdy
    14 hours
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=ivvzdzglzk
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment