Es gibt einmal die Klasse Profilpunkt
public class Profilpunkt
{
double d;
double h;
/**
* Konstruktor für Objekte der Klasse Profilpunkt
*/
public Profilpunkt(double d, double h)
{
this.d = d;
this.h = h;
}
public double getD()
{
return d;
}
public void setD(double d)
{
this.d = d;
}
public double getH()
{
return h;
}
public void setH(double h)
{
this.h = h;
}
public double steigung(Profilpunkt Q)
{
double dd= Q.d-d;
double dh = Q.h-h;
double udw = dd*dd+dh*dh;
return Math.sqrt(udw);
}
public double hoehendifferenz(Profilpunkt Q)
{
return this.h-Q.h;
}
}
Und die Klasse Profil
public class Profil
{
Profilpunkt[] profilpunkte;
public Profil(final Profilpunkt... profilpunkte)
{
this.profilpunkte = profilpunkte;
}
public Profilpunkt[] getProfilpunkte()
{
return profilpunkte;
}
public void setProfilpunkte(Profilpunkt[] profilpunkte)
{
this.profilpunkte = profilpunkte;
}
public Profil teilprofil(int i, int j)
{
if(i<j)
{
return Arrays.copyOfRange(profilpunkte, i, j);
}
}
}
Mit der Methode teilprofil will ich das Profil vom Punkt i bis Punkt j zurückgeben, aber es kommt
incompatible types no instance(s) of type variable(s) t exist so that...
public class Profilpunkt
{
double d;
double h;
/**
* Konstruktor für Objekte der Klasse Profilpunkt
*/
public Profilpunkt(double d, double h)
{
this.d = d;
this.h = h;
}
public double getD()
{
return d;
}
public void setD(double d)
{
this.d = d;
}
public double getH()
{
return h;
}
public void setH(double h)
{
this.h = h;
}
public double steigung(Profilpunkt Q)
{
double dd= Q.d-d;
double dh = Q.h-h;
double udw = dd*dd+dh*dh;
return Math.sqrt(udw);
}
public double hoehendifferenz(Profilpunkt Q)
{
return this.h-Q.h;
}
}
Und die Klasse Profil
public class Profil
{
Profilpunkt[] profilpunkte;
public Profil(final Profilpunkt... profilpunkte)
{
this.profilpunkte = profilpunkte;
}
public Profilpunkt[] getProfilpunkte()
{
return profilpunkte;
}
public void setProfilpunkte(Profilpunkt[] profilpunkte)
{
this.profilpunkte = profilpunkte;
}
public Profil teilprofil(int i, int j)
{
if(i<j)
{
return Arrays.copyOfRange(profilpunkte, i, j);
}
}
}
Mit der Methode teilprofil will ich das Profil vom Punkt i bis Punkt j zurückgeben, aber es kommt
incompatible types no instance(s) of type variable(s) t exist so that...