Tag Leute,
hab mal ne Frage und zwar, hier sagt der Kompiler: ';' expected
Wieso?
Code:
private int Eingabe;
Ccalc cc = new Ccalc();
public static void main()
{
System.out.println("Bitte Rechenart angeben:");
System.out.println("(1 für Multiplikation, 2 für Divition, 3 für Addition und 4 für Subtraktion:)");
If (Eingabe == 1) cc.multiplikation;
else If (Eingabe == 2) cc.divition;
else If (Eingabe == 3) cc.addition;
else If (Eingabe == 4) cc.subtraktion;
}
}
und hier sagt er: getx1 (int) in Cbruch cannot be applied to ()
was hab ich falsch gemacht?
Code:
public class Ccalc
{
public static int[] e = new int[4];
public static void multiplikation()
{
Cbruch Cb = new Cbruch();
Cb.getx1();
Cb.gety1();
Cb.getx2();
Cb.gety2();
e[0] = x1*x2;
e[1] = y1*y2;
}
public static void divition()
{
Cbruch Cb = new Cbruch();
Cb.getx1();
Cb.gety1();
Cb.getx2();
Cb.gety2();
e[0] = x1*y2;
e[1] = y1*x1;
}
public static void addition()
{
Cbruch Cb = new Cbruch();
Cb.getx1();
Cb.gety1();
Cb.getx2();
Cb.gety2();
e[2] = x1*y2 ;
e[3] = x2*y1;
e[1] = y1*y2;
e[0] = e[2]+e[3];
}
public static void subtraktion()
{
Cbruch Cb = new Cbruch();
Cb.getx1();
Cb.gety1();
Cb.getx2();
Cb.gety2();
e[2] = x1*y2 ;
e[3] = x2*y1;
e[1] = y1*y2;
e[0] = e[2]-e[3];
}
}
Diese Klasse habe ich noch (output lass ich weg

)
Code:
public class Cbruch
{
private static int x1 = 1;
private static int y1 = 2;
private static int x2 = 3;
private static int y2 = 4;
public static int getx1(int x1)
{
return x1;
}
public static int gety1(int y1)
{
return y1;
}
public static int getx2(int x2)
{
return x2;
}
public static int gety2(int y2)
{
return y2;
}
}
Es kann durch aus sein, dass es was ganz leichtes ist und ich es übersehe, denn ich bin noch nicht so vertraut mit java^^
Ich bedanke mich im voraus schonmal..
MfG Mario