Upload files to "Aufgaben/PTP_1"
This commit is contained in:
36
Aufgaben/PTP_1/BMI.java
Normal file
36
Aufgaben/PTP_1/BMI.java
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Aufgaben/PTP_1/BruttoNetto.java
Normal file
14
Aufgaben/PTP_1/BruttoNetto.java
Normal 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)
|
||||
}
|
||||
}
|
||||
16
Aufgaben/PTP_1/Eingabe.java
Normal file
16
Aufgaben/PTP_1/Eingabe.java
Normal 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
24
Aufgaben/PTP_1/J04A1.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user