Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Punkt{
- private double x;
- private double y;
- public Punkt(double x, double y) {
- this.x = x;
- this.y = y;
- }
- public Punkt przesuniecie(double a, double b) {
- this.x += a;
- this.y += b;
- return this;
- }
- public double odlegloscOdPocz() {
- this.x = x;
- this.y = y;
- return Math.sqrt(Math.pow(this.x , 2) + Math.pow(this.y , 2));
- }
- public String toString() {
- return "(" + x + ", " + y + ")";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment