Upload files to "Aufgaben/PTP_1"

This commit is contained in:
2025-07-29 08:24:47 +02:00
parent 01bab967a2
commit e55131f032
4 changed files with 90 additions and 0 deletions

36
Aufgaben/PTP_1/BMI.java Normal file
View File

@@ -0,0 +1,36 @@
public class BMI{
public static void main(String args[]){
double gewicht = 120;
double groesse = 1.8;
double bmi = gewicht / (groesse * groesse);
System.out.println("Dein BMI bei einer Größe von " + groesse + "m") ;
System.out.println("und einem Gewicht von " + gewicht + "kg");
System.out.println("beträgt " + bmi);
if (bmi < 16) {
System.out.println("Starkes Untergewicht");
}
else if(bmi < 17) {
System.out.println("Mäßiges Untergewicht");
}
else if(bmi < 18.5) {
System.out.println("Leichtes Untergewicht");
}
else if (bmi < 25) {
System.out.println("Normalgewicht");
}
else if (bmi < 30) {
System.out.println("Übergewicht");
}
else if (bmi < 35) {
System.out.println("Adipositas I");
}
else if (bmi < 40) {
System.out.println("Adipositas II");
}
else {
System.out.println("Adipositas III");
}
}
}

View File

@@ -0,0 +1,14 @@
public class BruttoNetto {
public static void main(String args[]){
double brutto = 50.0;
double netto = brutto / 1.19;
double ust = brutto - netto;
System.out.println("Netto: " + netto);
System.out.println("USt: " + ust);
System.out.println("USt-Aktion: " + (ust / brutto));
// netto = 100% = brutto / (1 + 19/100)
// brutto = 119% = netto * (1 + 19/100)
}
}

View File

@@ -0,0 +1,16 @@
import java.util.Scanner;
public class Eingabe {
public static void main(String args[]){
Scanner eingabe = new Scanner(System.in);
System.out.print("Bitte eine ganze Zahl eingeben: ");
if(eingabe.hasNextInt()){
int zahl = eingabe.nextInt();
System.out.println("Das Quadrat von " + zahl + " ist " + (zahl * zahl));
}
else {
System.out.println("Bitte nur ganze Zahlen eingeben!!");
}
}
}

24
Aufgaben/PTP_1/J04A1.java Normal file
View File

@@ -0,0 +1,24 @@
import java.util.Scanner;
public class J04A1 {
public static void main(String args[]){
char firstChar = 'N';
switch (firstChar) {
case 'j':
System.out.println("ja");
break;
case 'J':
System.out.println("Ja");
break;
case 'n':
System.out.println("nein");
break;
case 'N':
System.out.println("Nein");
break;
}
}
}