Hey ihr lieben. Ich erstelle gerade einen neuen Datentyp Stein, doch der Kompiler beschwert sich, dass ich Syntax errors hätte und empört sich an einem Komma.... doch ich verzweifle hier seit über 6 Stunden auf der Fehlersuche - hat jemand von euch vielleicht eine Lösung?
Die Arrays oben sind Klassenvariablen, und werden in dieser klasse gebraucht, daher weiß ich nicht was der kompiler von mir will wenn er sagt misplaced construct
Code:
package varaibles;
public class Stone {
double Lenght = 0;
double Height = 0;
double Width = 0;
double[] A = new double[4];
A[1] = 0;
A[2] = 0;
A[3] = 0;
double[] B = new double[4];
B[1] = 0;
B[2] = 0;
B[3] = 0;
double[] C = new double[4];
C[1] = 0;
C[2] = 0;
C[3] = 0;
double[] D = new double[4];
D[1] = 0;
D[2] = 0;
D[3] = 0;
double[] E = new double[4];
E[1] = 0;
E[2] = 0;
E[3] = 0;
double[] F = new double[4];
F[1] = 0;
F[2] = 0;
F[3] = 0;
double[] G = new double[4];
G[1] = 0;
G[2] = 0;
G[3] = 0;
double[] H = new double[4];
H[1] = 0;
H[2] = 0;
H[3] = 0;
public void setLenght (double m){
this.Lenght = m;
//Länge AB
if (this.B[1] - this.A[1] != this.Lenght){
this.B[1] = this.A[1] + this.Lenght;
}
//Länge EF
if (this.F[1] - this.E[1] != this.Lenght){
this.F[1] = this.E[1] + this.Lenght;
}
//Länge DC
if (this.C[1] - this.D[1] != this.Lenght){
this.C[1] = this.D[1] + this.Lenght;
}
//Länge HG
if (this.G[1] - this.H[1] != this.Lenght){
this.G[1] = this.H[1] + this.Lenght;
}
}
public void setWidth (double m){
this.Width = m;
//Breite AE
if (this.E[3] - this.A[3] != this.Lenght){
this.E[3] = this.A[3] + this.Lenght;
}
//Breite BF
if (this.F[3] - this.B[3] != this.Lenght){
this.F[3] = this.B[3] + this.Lenght;
}
//Breite CG
if (this.G[3] - this.C[3] != this.Lenght){
this.G[3] = this.C[3] + this.Lenght;
}
//Breite DH
if (this.H[3] - this.D[3] != this.Lenght){
this.H[3] = this.D[3] + this.Lenght;
}
}
public void setHeight (double m){
this.Height = m;
//Höhe AD
if (this.D[2] - this.A[2] != this.Lenght){
this.D[2] = this.A[2] + this.Lenght;
}
//Höhe BC
if (this.C[2] - this.B[2] != this.Lenght){
this.C[2] = this.B[2] + this.Lenght;
}
//Höhe FG
if (this.G[2] - this.F[2] != this.Lenght){
this.G[2] = this.F[2] + this.Lenght;
}
//Höhe EH
if (this.H[2] - this.E[2] != this.Lenght){
this.H[2] = this.E[2] + this.Lenght;
}
}
public void setCoordsA (double x, double y, double z){
this.A[1] = x;
this.A[2] = y;
this.A[3] = z;
if (this.B[1] - this.A[1] != this.Lenght){
this.Lenght = this.B[1] - this.A[1];
}
if (this.D[2] - this.A[2] != this.Height){
this.Height = this.D[2] - this.A[2];
}
if (this.E[3] - this.A[3] != this.Width){
this.Width = this.E[3] - this.A[3];
}
}
public void setCoordsB (double x, double y, double z){
this.B[1] = x;
this.B[2] = y;
this.B[3] = z;
if (this.B[1] - this.A[1] != this.Lenght){
this.Lenght = this.B[1] - this.A[1];
}
if (this.C[2] - this.B[2] != this.Height){
this.Height = this.C[2] - this.B[2];
}
if (this.F[3] - this.B[3] != this.Width){
this.Width = this.F[3] - this.B[3];
}
}
public void setCoordsC (double x, double y, double z){
this.C[1] = x;
this.C[2] = y;
this.C[3] = z;
//Länge
if (this.D[1] - this.C[1] != this.Lenght){
this.Lenght = this.D[1] - this.C[1];
}
//Höhe
if (this.C[2] - this.B[2] != this.Height){
this.Height = this.C[2] - this.B[2];
}
//Breite
if (this.G[3] - this.C[3] != this.Width){
this.Width = this.G[3] - this.C[3];
}
}
public void setCoordsD (double x, double y, double z){
this.D[1] = x;
this.D[2] = y;
this.D[3] = z;
//Länge
if (this.C[1] - this.D[1] != this.Lenght){
this.Lenght = this.C[1] - this.D[1];
}
//Höhe
if (this.D[2] - this.A[2] != this.Height){
this.Height = this.D[2] - this.A[2];
}
//Breite
if (this.H[3] - this.D[3] != this.Width){
this.Width = this.H[3] - this.D[3];
}
}
public void setCoordsE (double x, double y, double z){
this.E[1] = x;
this.E[2] = y;
this.E[3] = z;
//Länge
if (this.F[1] - this.E[1] != this.Lenght){
this.Lenght = this.F[1] - this.E[1];
}
//Höhe
if (this.H[2] - this.E[2] != this.Height){
this.Height = this.H[2] - this.E[2];
}
//Breite
if (this.F[3] - this.E[3] != this.Width){
this.Width = this.F[3] - this.E[3];
}
public void setCoordsF (double x, double y, double z){
this.F[1] = x;
this.F[2] = y;
this.F[3] = z;
//Länge
if (this.F[1] - this.E[1] != this.Lenght){
this.Lenght = this.F[1] - this.E[1];
}
//Höhe
if (this.G[2] - this.F[2] != this.Height){
this.Height = this.G[2] - this.F[2];
}
//Breite
if (this.F[3] - this.B[3] != this.Width){
this.Width = this.F[3] - this.B[3];
}
public void setCoordsG (double x, double y, double z){
this.G[1] = x;
this.G[2] = y;
this.G[3] = z;
//Länge
if (this.C[1] - this.D[1] != this.Lenght){
this.Lenght = this.C[1] - this.D[1];
}
//Höhe
if (this.D[2] - this.A[2] != this.Height){
this.Height = this.D[2] - this.A[2];
}
//Breite
if (this.H[3] - this.D[3] != this.Width){
this.Width = this.H[3] - this.D[3];
}
}
public void setCoordsH (double x, double y, double z){
this.H[1] = x;
this.H[2] = y;
this.H[3] = z;
//Länge
if (this.G[1] - this.H[1] != this.Lenght){
this.Lenght = this.G[1] - this.H[1];
}
//Höhe
if (this.H[2] - this.E[2] != this.Height){
this.Height = this.H[2] - this.E[2];
}
//Breite
if (this.H[3] - this.D[3] != this.Width){
this.Width = this.H[3] - this.D[3];
}
}
public double[] getCoordsA(){
return this.A[];
}
public double[] getCoordsB(){
return this.B[];
}
public double[] getCoordsC(){
return this.C[];
}
public double[] getCoordsD(){
return this.D[];
}
public double[] getCoordsE(){
return this.E[];
}
public double[] getCoordsF(){
return this.F[];
}
public double[] getCoordsG(){
return this.G[];
}
public double[] getCoordsH(){
return this.H[];
}
public double getLength(){
return this.Lenght;
}
public double getWidth(){
return this.Width;
}
public double getHeight(){
return this.Height;
}
}
Die Arrays oben sind Klassenvariablen, und werden in dieser klasse gebraucht, daher weiß ich nicht was der kompiler von mir will wenn er sagt misplaced construct