Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class vektor{
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- double x, y, z, a;
- System.out.println("Geben sie die x-Koordinate an:");
- x = keyboard.nextDouble();
- System.out.println("Geben sie die y-Koordinate an:");
- y = keyboard.nextDouble();
- System.out.println("Geben sie die z-Koordinate an:");
- z = keyboard.nextDouble();
- // Betrag des Vektors
- a= Math.sqrt(x*x+y*y+z*z);
- System.out.println("Der Betrag des Vektors beträgt=" +a);
- //Einheitsvektor??
- if (a==1) {
- System.out.println("Der angegebene Vektor ist ein Einheitsvektor.");
- } else {
- System.out.println("Der angegebene Vektor ist KEIN Einheitsvektor.");
- }
- //Basisvektor??
- if (x==0 && y==0) {
- System.out.println("Der Vektor ist der Basisvektor in z-Richtung.");
- }
- if (z==0 && y==0) {
- System.out.println("Der Vektor ist der Basisvektor in x-Richtung.");
- }
- if (x==0 && z==0) {
- System.out.println("Der Vektor ist der Basisvektor in y-Richtung.");
- }
- if (x!=0 && y!=0 && z!=0) {
- System.out.println(" Es liegt kein Basisvektor vor.");
- } // end of if
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement