Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point {
- private float x;
- private float y;
- public Point(float x, float y) {
- changeCoords(x, y);
- }
- public void changeCoords(float x, float y) {
- this.x = x;
- this.y = y;
- }
- @Override
- public String toString() {
- return "(" + x + ", " + y + ")";
- }
- }
- class Polygon {
- private final Point[] points;
- public Polygon(int n) {
- points = new Point[n];
- for (int i = 0; i < n; i++) {
- points[i] = new Point(0, 0);
- }
- }
- public Polygon(float[] coords) {
- if (coords.length % 2 != 0) {
- throw new IllegalArgumentException("len is odd");
- }
- int n = coords.length / 2;
- this(n);
- for (int i = 0; i < n; i++) {
- points[i] = new Point(coords[2 * i], coords[2 * i + 1]);
- }
- }
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("Polygon: ");
- for (Point p : points) {
- sb.append(p.toString()).append(" ");
- }
- return sb.toString();
- }
- }
- public class Main {
- public static void main(String[] args) {
- Polygon poly1 = new Polygon(3);
- System.out.println(poly1);
- float[] coords = {0, 0, 1, 0, 1, 1, 0, 1};
- Polygon poly2 = new Polygon(coords);
- System.out.println(poly2);
- }
- }
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=ivvzdzglzk
- 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.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment