fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. public class Main {
  8.  
  9. public static void main(String[] args) {
  10.  
  11. class Ponto {
  12. private double x, y;
  13.  
  14. public Ponto() {
  15. x = 0;
  16. y = 0;
  17. }
  18.  
  19. public Ponto(double x, double y) {
  20. this.x = x;
  21. this.y = y;
  22. }
  23.  
  24. public void mover(double x, double y) {
  25. this.x = x;
  26. this.y = y;
  27. }
  28.  
  29. public double getX() {
  30. return x;
  31. }
  32.  
  33. public double getY() {
  34. return y;
  35. }
  36.  
  37. public double distancia() {
  38. double distancia;
  39. distancia = (double) Math.sqrt(x * x + y * y);
  40. return distancia;
  41. }
  42.  
  43. public String toString() {
  44. return "Ponto (" + x + "," + y + ")";
  45. }
  46. }
  47. }
  48. }
Success #stdin #stdout 0.09s 46940KB
stdin
Standard input is empty
stdout
Standard output is empty