Upload files to "Aufgaben/PTP_1"
This commit is contained in:
25
Aufgaben/PTP_1/Verzweigung.java
Normal file
25
Aufgaben/PTP_1/Verzweigung.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
public class Verzweigung {
|
||||||
|
public static void main(String args[]){
|
||||||
|
int alter = 75;
|
||||||
|
|
||||||
|
if ( alter < 20 ) {
|
||||||
|
System.out.println("Du bist aber noch jung!");
|
||||||
|
}
|
||||||
|
else if ( alter < 30) {
|
||||||
|
System.out.println("Ist noch ok!");
|
||||||
|
}
|
||||||
|
else if (alter < 40 ) {
|
||||||
|
System.out.println("Grenzwertig :-P");
|
||||||
|
}
|
||||||
|
else if ( alter < 50) {
|
||||||
|
System.out.println("Die Rente ist in Sicht");
|
||||||
|
}
|
||||||
|
else if ( alter < 60 ) {
|
||||||
|
System.out.println("Bist du aber alt!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("Na, ganz frisch bist du auch nicht mehr!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Aufgaben/PTP_1/VerzweigungSwitch.java
Normal file
30
Aufgaben/PTP_1/VerzweigungSwitch.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
public class VerzweigungSwitch {
|
||||||
|
public static void main(String args[]){
|
||||||
|
int zahl = 4;
|
||||||
|
|
||||||
|
switch (zahl) {
|
||||||
|
case 1:
|
||||||
|
System.out.println("Sehr gut");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
System.out.println("Gut");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
System.out.println("Befriedigend");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
System.out.println("Ausreichend");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
System.out.println("Mangelhaft");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
System.out.println("Ungenügend");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println("Du hast keine gültige Note eingegeben!");
|
||||||
|
|
||||||
|
} // end of switch
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user