I
irina1988
Gast
hey leute, hab folgendes programm, und verstehe nicht wo der fehler ist:
import java.io.*;
public class Aufgabe3 {
static int a = 0;
static int b = 0;
static int c = 0;
public int a_quadrat(){
return a * a ;
}
public int b_quadrat(){
return b * b;
}
public int c_quadrat(){
return c * c;
}
public static void main (String[] args) {
BufferedReader in = new BufferedReader(new inputStreamReader(System.in));
System.out.println("Geben sie die erste Zahl ein: ");
int a_quadrat= Integer.parseInt(in.readLine());
System.out.println("Geben sie die zweite Zahl ein: ");
int b_quadrat= Integer.parseInt(in.readLine());
System.out.println("Geben sie die dritte Zahl ein: ");
int c_quadrat= Integer.parseInt(in.readLine ());
if (a_quadrat + b_quadrat == c_quadrat())
{
System.out.println ("Es handelt sich um ein phyt. Trippel.");
}
else { System.out.println ("Es handelt sich nicht um ein phyt. Trippel.");
}
}
}
Fehlermeldung:
Compiliere C:\Dokumente und Einstellungen\igeiger\Desktop\Informatik\Aufgabe3.java mit Java-Compiler
Aufgabe3.java:22: cannot find symbol
symbol : class inputStreamReader
location: class Aufgabe3
BufferedReader in = new BufferedReader(new inputStreamReader(System.in));
^
Aufgabe3.java:31: non-static method c_quadrat() cannot be referenced from a static context
if (a_quadrat + b_quadrat == c_quadrat())
^
2 errors
kann mir bitte jemand sagen, wo der fehler ist?
über hilfe würde ich mich freuen.
import java.io.*;
public class Aufgabe3 {
static int a = 0;
static int b = 0;
static int c = 0;
public int a_quadrat(){
return a * a ;
}
public int b_quadrat(){
return b * b;
}
public int c_quadrat(){
return c * c;
}
public static void main (String[] args) {
BufferedReader in = new BufferedReader(new inputStreamReader(System.in));
System.out.println("Geben sie die erste Zahl ein: ");
int a_quadrat= Integer.parseInt(in.readLine());
System.out.println("Geben sie die zweite Zahl ein: ");
int b_quadrat= Integer.parseInt(in.readLine());
System.out.println("Geben sie die dritte Zahl ein: ");
int c_quadrat= Integer.parseInt(in.readLine ());
if (a_quadrat + b_quadrat == c_quadrat())
{
System.out.println ("Es handelt sich um ein phyt. Trippel.");
}
else { System.out.println ("Es handelt sich nicht um ein phyt. Trippel.");
}
}
}
Fehlermeldung:
Compiliere C:\Dokumente und Einstellungen\igeiger\Desktop\Informatik\Aufgabe3.java mit Java-Compiler
Aufgabe3.java:22: cannot find symbol
symbol : class inputStreamReader
location: class Aufgabe3
BufferedReader in = new BufferedReader(new inputStreamReader(System.in));
^
Aufgabe3.java:31: non-static method c_quadrat() cannot be referenced from a static context
if (a_quadrat + b_quadrat == c_quadrat())
^
2 errors
kann mir bitte jemand sagen, wo der fehler ist?
über hilfe würde ich mich freuen.