Upload files to "Aufgaben/PTP_1"

This commit is contained in:
2025-07-29 08:26:22 +02:00
parent ac95b23213
commit e566c9d5e2
2 changed files with 55 additions and 0 deletions

View 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!");
}
}
}

View 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
}
}