Compare commits
4 Commits
3e064693bf
...
cba4d08315
Author | SHA1 | Date | |
---|---|---|---|
cba4d08315 | |||
4257cab1fa | |||
d64c33dfe5 | |||
dc781ca0bd |
@ -1,5 +0,0 @@
|
|||||||
class Aufgabe {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("Hallo Welt");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
class Aufgabe {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
// Die drei Zahlen für die Prüfung definieren.
|
|
||||||
int a = 3;
|
|
||||||
int b = 4;
|
|
||||||
int c = 5;
|
|
||||||
|
|
||||||
// Die Zahlen überprüfen und das Ergebnis ausgeben.
|
|
||||||
System.out.println("Werte entsprechen dem Satz des Pythagoras: " + (check(a,b,c) ? "Ja" : "Nein"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prüfen ob die angegebenen Zahlen dem Satz des Pythagoras entsprechen.
|
|
||||||
* @param a Die erste Zahl (a).
|
|
||||||
* @param b Die zweite Zahl (b).
|
|
||||||
* @param c Das Ergebnis (c).
|
|
||||||
* @return Status ob die angegebenen Zahlen dem Satz des Pythagoras entsprechen.
|
|
||||||
*/
|
|
||||||
public static boolean check(int a, int b, int c) {
|
|
||||||
return (a*a + b*b == c*c) ? true : false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
class Aufgabe {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
int i = 5;
|
|
||||||
int j = 3;
|
|
||||||
boolean b = false;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* a.) (!((i<j) && b)) - boolean (true)
|
|
||||||
* b.) i/j - int (1)
|
|
||||||
* c.) (float) (i/j) - float (1.0)
|
|
||||||
* d.) (float) i/j - float (1.6)
|
|
||||||
* e.) (float) i / (float) j - float (1.6)
|
|
||||||
* f.) ((i++ == 5) || (--i == 5)) - boolean (true)
|
|
||||||
* g.) ((i++ == 5) | (--i == 5)) - int (1)
|
|
||||||
*/
|
|
||||||
|
|
||||||
System.out.println("a.) " + (!((i<j) && b)));
|
|
||||||
System.out.println("b.) " + (i/j));
|
|
||||||
System.out.println("c.) " + (float) (i/j));
|
|
||||||
System.out.println("d.) " + ((float) i/j));
|
|
||||||
System.out.println("e.) " + ((float) i / (float) j));
|
|
||||||
System.out.println("f.) " + (((i++ == 5) || (--i == 5))));
|
|
||||||
System.out.println("g.) " + (((i++ == 5) | (--i == 5))));
|
|
||||||
}
|
|
||||||
}
|
|
12
VL03/Aufgabe01/Aufgabe01.java
Normal file
12
VL03/Aufgabe01/Aufgabe01.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package VL03.Aufgabe01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vorlesung 3 / Aufgabe 1
|
||||||
|
*
|
||||||
|
* @author Sebastian Brosch
|
||||||
|
*/
|
||||||
|
public class Aufgabe01 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hallo Welt");
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,29 @@
|
|||||||
class Aufgabe {
|
package VL03.Aufgabe02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vorlesung 3 / Aufgabe 2
|
||||||
|
*
|
||||||
|
* @author Sebastian Brosch
|
||||||
|
*/
|
||||||
|
public class Aufgabe02 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int a1 = 2;
|
int a1 = 2;
|
||||||
int a2 = 4;
|
int a2 = 4;
|
||||||
int a3 = 6;
|
int a3 = 6;
|
||||||
|
|
||||||
|
System.out.printf("a1: %d, a2: %d, a3: %d\n\n", a1, a2, a3);
|
||||||
|
|
||||||
System.out.println("a.) Arithmetisches Mittel: " + ((a1 + a2 + a3) / 3));
|
System.out.println("a.) Arithmetisches Mittel: " + ((a1 + a2 + a3) / 3));
|
||||||
System.out.println("b.) Ist " + a1 + " < " + a2 + " < " + a3 + "? " + (a1 < a2 && a2 < a3 ? "Ja" : "Nein"));
|
System.out.println("b.) Ist " + a1 + " < " + a2 + " < " + a3 + "? " + (a1 < a2 && a2 < a3 ? "Ja" : "Nein"));
|
||||||
System.out.println("c.) Ist " + a1 + " ein ganzzahliges Vielfaches von " + a2 + "? " + (a1 % a2 == 0 ? "Ja" : "Nein"));
|
System.out.println("c.) Ist " + a1 + " ein Vielfaches von " + a2 + "? " + (a1 % a2 == 0 ? "Ja" : "Nein"));
|
||||||
System.out.println("d.) " + a3 + " invertiert: " + (~a3));
|
System.out.println("d.) " + a3 + " invertiert: " + (~a3));
|
||||||
|
|
||||||
a3 = Integer.MAX_VALUE;
|
a3 = Integer.MAX_VALUE;
|
||||||
System.out.println("e.) Größter positiver Integer-Wert: " + (a3));
|
System.out.println("e.) Größter positiver Integer-Wert: " + (a3));
|
||||||
System.out.println("f.) Größter postiver Integer-Wert + 1: " + (a3 + 1));
|
System.out.println("f.) Größter postiver Integer-Wert + 1: " + (a3 + 1));
|
||||||
|
|
||||||
|
a2 = 0xFFFFFFFF;
|
||||||
|
a2 = ~(a3 << a2);
|
||||||
|
System.out.println("g.) a2 (0xFFFFFFFF) nach a3 umwandeln: " + a2);
|
||||||
}
|
}
|
||||||
}
|
}
|
30
VL03/Aufgabe03/Aufgabe03.java
Normal file
30
VL03/Aufgabe03/Aufgabe03.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package VL03.Aufgabe03;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vorlesung 3 / Aufgabe 3
|
||||||
|
*
|
||||||
|
* @author Sebastian Brosch
|
||||||
|
*/
|
||||||
|
public class Aufgabe03 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int a = 3;
|
||||||
|
int b = 4;
|
||||||
|
int c = 5;
|
||||||
|
|
||||||
|
System.out.printf("a: %d, b: %d, c: %d\n", a, b, c);
|
||||||
|
System.out.println("Werte entsprechen dem Satz des Pythagoras: " + (check(a, b, c) ? "Ja" : "Nein"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to check three numbers against the pythagorean theorem.
|
||||||
|
*
|
||||||
|
* @param a The first number (a in formula).
|
||||||
|
* @param b The second number (b in formula).
|
||||||
|
* @param c The result of the theorem (c in formula).
|
||||||
|
* @return The state whether the three numbers are matching the pythagorean
|
||||||
|
* theorem.
|
||||||
|
*/
|
||||||
|
public static boolean check(int a, int b, int c) {
|
||||||
|
return (a * a + b * b == c * c) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
22
VL03/Aufgabe04/Aufgabe04.java
Normal file
22
VL03/Aufgabe04/Aufgabe04.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package VL03.Aufgabe04;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vorlesung 3 / Aufgabe 4
|
||||||
|
*
|
||||||
|
* @author Sebastian Brosch
|
||||||
|
*/
|
||||||
|
public class Aufgabe04 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int i = 5;
|
||||||
|
int j = 3;
|
||||||
|
boolean b = false;
|
||||||
|
|
||||||
|
System.out.println("a.) " + (!((i < j) && b)));
|
||||||
|
System.out.println("b.) " + (i / j));
|
||||||
|
System.out.println("c.) " + (float) (i / j));
|
||||||
|
System.out.println("d.) " + ((float) i / j));
|
||||||
|
System.out.println("e.) " + ((float) i / (float) j));
|
||||||
|
System.out.println("f.) " + (((i++ == 5) || (--i == 5))));
|
||||||
|
System.out.println("g.) " + (((i++ == 5) | (--i == 5))));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user