import java.io.*; public classprogramm { publicstatic void main(String[] args) { BufferedReader taste = new BufferedReader(new InputStreamReader(System.in)); try{
System.out.println("Die CramerscheRegel"); System.out.println(); System.out.println(); System.out.println("Formel:"); System.out.println("ax + ay + az = ad"); System.out.println("bx + by + bz = bd"); System.out.println("cx+ cy + cz = cd");//(1) doubleax, bx, cx; double ay, by, cy; double az, bz, cz; double ad, bd, cd; double D, Dx, Dy, Dz; System.out.println(); System.out.println(); System.out.println("Geben Sie alle x-Werte ein ein!"); System.out.println(); ax = Double.parseDouble(taste.readLine()); bx = Double.parseDouble(taste.readLine()); cx = Double.parseDouble(taste.readLine());//(3) System.out.println(); System.out.println("Geben Sie alle y-Werteein!"); System.out.println(); ay = Double.parseDouble(taste.readLine()); by = Double.parseDouble(taste.readLine()); cy = Double.parseDouble(taste.readLine()); System.out.println(); System.out.println("Geben Sie alle z-Werteein!"); System.out.println(); az = Double.parseDouble(taste.readLine()); bz = Double.parseDouble(taste.readLine()); cz = Double.parseDouble(taste.readLine()); System.out.println(); System.out.println("Geben Sie alle d-Werteein!"); System.out.println(); ad = Double.parseDouble(taste.readLine()); bd = Double.parseDouble(taste.readLine()); cd = Double.parseDouble(taste.readLine()); System.out.println(); System.out.println(); D = ax * (by * cz - bz * cy) - ay * (bx *cz - bz * cx) + az * (bx * cy - by * cx); System.out.println(" D = " + D); System.out.println(); Dx = ad * (by * cz - bz * cy) - ay * (bd *cz -bz * cd) + az * (bd * cy - by * cd); System.out.println(" Dx = " + Dx); System.out.println(); Dy = ax * (bd * cz - bz * cd) - ad * (bx *cz - bz * cx) + az * (bx * cd - bd * cx); System.out.println(" Dy = " + Dy); System.out.println(); Dz = ax * (by * cd - bd * cy) - ay * (bx *cd - bd * cx) + ad * (bx * cy - by * cx);//(7) System.out.println(" Dz = " + Dz); System.out.println(); System.out.println(); System.out.println("x = " + Dx / D); System.out.println(); System.out.println("y = " + Dy / D); System.out.println(); System.out.println("z = " + Dz / D);//(8) System.out.println(); }catch(IOExceptione){ System.out.println("Es gibt einen Fehler beim Einlesen"); } }
}
|