Error when trying to implement Abstract data type class

Asked

Viewed 22 times

0

I need to implement a TAD in repl.it, but gives the following error:

Error: Could not find or load main class Main Exit status 1

import java.lang.Math;

class Ponto {

  public int x;

  public int y;

  public Ponto(int x, int y) {
    this.x = x;
    this.y = y;

  }

  public boolean igual(Ponto p) {
    return this.x == p.x && this.y == p.y;

  }

  public String texto() {
    return (this.x + " " + this.y);
  }

  public double distancia(Ponto p) {
    double d1 = this.x - p.x;
    double d2 = this.y - p.y;
    return Math.sqrt((d1*d1)+(d2*d2));
  }

  public void translada(int dx, int dy) {
    this.x = this.x+dx;
    this.y = this.y+dy;

  }

  public static void main(String[] args) {
   Ponto ponto = new Ponto(2, 3);
   String texto = ponto.texto();
   System.out.println(texto); // Imprime (2, 3);

  }
}
  • I implemented it that way and it’s making a mistake.

  • It would be interesting then to question the author of the reply commenting, even more if his answer is in trouble.

  • @The problem is Samarone’s reputation. He doesn’t have the power to comment on other people’s posts yet. So I THINK in this case it can be re-opened by altering the question with the frustrated attempt.

  • @the problem is that he created another profile to ask this question, instead of using what he did the other, it’s the same user, with the other profile he could comment, as its creator.

  • Roger @Articuno

  • I’m desperate, guys, I’ve been getting into an ADS college and I have no affinity for algorithms, I’ve already graduated but a data structure DP has been following me for a while, I just want to finish this college and see if I can get something better in the infra area which is what I do currently.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.