Aufgaben
This commit is contained in:
BIN
Zimmermann, Sascha/01_Hamster_Einführung.pdf
Normal file
BIN
Zimmermann, Sascha/01_Hamster_Einführung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/02_Hamster_Variablen.pdf
Normal file
BIN
Zimmermann, Sascha/02_Hamster_Variablen.pdf
Normal file
Binary file not shown.
63
Zimmermann, Sascha/Auto.java
Normal file
63
Zimmermann, Sascha/Auto.java
Normal file
@@ -0,0 +1,63 @@
|
||||
public class Auto {
|
||||
|
||||
// Anfang Attribute
|
||||
private String Farbe;
|
||||
private int leistung;
|
||||
private int anzTueren;
|
||||
private String Hersteller;
|
||||
// Ende Attribute
|
||||
|
||||
public Auto(String Farbe, int leistung, int anzTueren, String Hersteller) {
|
||||
this.Farbe = Farbe;
|
||||
this.leistung = leistung;
|
||||
this.anzTueren = anzTueren;
|
||||
this.Hersteller = Hersteller;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public String getFarbe() {
|
||||
return Farbe;
|
||||
}
|
||||
|
||||
public void setFarbe(String FarbeNeu) {
|
||||
Farbe = FarbeNeu;
|
||||
}
|
||||
|
||||
public int getLeistung() {
|
||||
return leistung;
|
||||
}
|
||||
|
||||
public void setLeistung(int leistungNeu) {
|
||||
leistung = leistungNeu;
|
||||
}
|
||||
|
||||
public int getAnzTueren() {
|
||||
return anzTueren;
|
||||
}
|
||||
|
||||
public void setAnzTueren(int anzTuerenNeu) {
|
||||
anzTueren = anzTuerenNeu;
|
||||
}
|
||||
|
||||
public String getHersteller() {
|
||||
return Hersteller;
|
||||
}
|
||||
|
||||
public void setHersteller(String HerstellerNeu) {
|
||||
Hersteller = HerstellerNeu;
|
||||
}
|
||||
|
||||
public void tuning(int leistungNeu) {
|
||||
double leistungMax = leistung * 0.2;
|
||||
|
||||
if(leistungNeu < leistungMax){
|
||||
leistung += leistungNeu;
|
||||
System.out.println("Das Tuning wurde durchgeführt, das Auto hat jetzt " + leistung + "PS");
|
||||
}
|
||||
else{
|
||||
System.out.println("Das Tuning übersteigt die Möglichkeiten des Fahrzeugs. Es können maximal " + leistungMax + "PS hinzukommen!");
|
||||
}
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Auto
|
||||
36
Zimmermann, Sascha/Auto.uml
Normal file
36
Zimmermann, Sascha/Auto.uml
Normal file
@@ -0,0 +1,36 @@
|
||||
[Files]
|
||||
File0=Auto.java
|
||||
File1=AutoAufruf.java
|
||||
|
||||
[Box: - Auto]
|
||||
X=20
|
||||
Y=40
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
|
||||
[Box: - AutoAufruf]
|
||||
X=647
|
||||
Y=244
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
|
||||
[Diagram]
|
||||
comments=0
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
Visibility=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
ShowConnections=0
|
||||
Fontname=Segoe UI
|
||||
Fontsize=12
|
||||
ShowObjectDiagram=0
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
|
||||
9
Zimmermann, Sascha/AutoAufruf.java
Normal file
9
Zimmermann, Sascha/AutoAufruf.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class AutoAufruf {
|
||||
public static void main(String args[]){
|
||||
Auto car = new Auto("Rot", 140, 5, "GHSE");
|
||||
|
||||
System.out.println("Das Auto von " + car.getHersteller() + " ist " + car.getFarbe() + ", hat " + car.getLeistung() + "PS und " + car.getAnzTueren() + " Türen.");
|
||||
car.tuning(40);
|
||||
car.tuning(25);
|
||||
}
|
||||
} // end of AutoAufruf
|
||||
BIN
Zimmermann, Sascha/J01_Einführung.pdf
Normal file
BIN
Zimmermann, Sascha/J01_Einführung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J02_Variablen.pdf
Normal file
BIN
Zimmermann, Sascha/J02_Variablen.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J03_Eingaben.pdf
Normal file
BIN
Zimmermann, Sascha/J03_Eingaben.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J04_Info bmi.pdf
Normal file
BIN
Zimmermann, Sascha/J04_Info bmi.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J04_Verzweigungen.pdf
Normal file
BIN
Zimmermann, Sascha/J04_Verzweigungen.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J05_Arrays.pdf
Normal file
BIN
Zimmermann, Sascha/J05_Arrays.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J06_Methoden.pdf
Normal file
BIN
Zimmermann, Sascha/J06_Methoden.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J07_Fehlerbehandlung.pdf
Normal file
BIN
Zimmermann, Sascha/J07_Fehlerbehandlung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J08_Eingaben - BufferedReader.pdf
Normal file
BIN
Zimmermann, Sascha/J08_Eingaben - BufferedReader.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J09_Dateiverarbeitung.pdf
Normal file
BIN
Zimmermann, Sascha/J09_Dateiverarbeitung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/J10_Mathematisches.pdf
Normal file
BIN
Zimmermann, Sascha/J10_Mathematisches.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO01_Einführung.pdf
Normal file
BIN
Zimmermann, Sascha/JO01_Einführung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO02_Konstruktor.pdf
Normal file
BIN
Zimmermann, Sascha/JO02_Konstruktor.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO03_Mehrere Klassen1 - Verweis.pdf
Normal file
BIN
Zimmermann, Sascha/JO03_Mehrere Klassen1 - Verweis.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO04_Mehrere Klassen2 - Vererbung.pdf
Normal file
BIN
Zimmermann, Sascha/JO04_Mehrere Klassen2 - Vererbung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO05_Vererbung_Übung.pdf
Normal file
BIN
Zimmermann, Sascha/JO05_Vererbung_Übung.pdf
Normal file
Binary file not shown.
BIN
Zimmermann, Sascha/JO06_Array und Arraylist.pdf
Normal file
BIN
Zimmermann, Sascha/JO06_Array und Arraylist.pdf
Normal file
Binary file not shown.
38
Zimmermann, Sascha/Noten.java
Normal file
38
Zimmermann, Sascha/Noten.java
Normal file
@@ -0,0 +1,38 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
public class Noten{
|
||||
public static void main(String args[]){
|
||||
double[] noten = new double[6];
|
||||
double summe = 0;
|
||||
|
||||
// Noten eingeben und prüfen
|
||||
Scanner eingabe = new Scanner(System.in);
|
||||
|
||||
for (int i = 0; i < noten.length; i++) {
|
||||
System.out.print("Bitte Note Nr. " + (i+1) + " eingeben: ");
|
||||
double note = eingabe.nextDouble();
|
||||
if(note >= 1 && note <= 6){
|
||||
noten[i] = note;
|
||||
}
|
||||
else{
|
||||
System.out.println("Die Note muss zwischen 1 und 6 liegen!");
|
||||
i--;
|
||||
}
|
||||
} // end of for
|
||||
|
||||
|
||||
// Noten sortiert ausgeben
|
||||
Arrays.sort(noten);
|
||||
|
||||
for (int i = 0; i < noten.length; i++) {
|
||||
System.out.println("Note Nr. " + (i+1) + " lautet " + noten[i]);
|
||||
summe += noten[i];
|
||||
} // end of for
|
||||
|
||||
// Durchschnitt aus Summe der Noten und Array-Größe berechnen
|
||||
double durchschnitt = summe / noten.length;
|
||||
|
||||
System.out.println("Der Durchschnitt ist " + durchschnitt);
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/BMI.class
Normal file
BIN
Zimmermann, Sascha/PTP1/BMI.class
Normal file
Binary file not shown.
36
Zimmermann, Sascha/PTP1/BMI.java
Normal file
36
Zimmermann, Sascha/PTP1/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");
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/BruttoNetto.class
Normal file
BIN
Zimmermann, Sascha/PTP1/BruttoNetto.class
Normal file
Binary file not shown.
14
Zimmermann, Sascha/PTP1/BruttoNetto.java
Normal file
14
Zimmermann, Sascha/PTP1/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)
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Eingabe.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Eingabe.class
Normal file
Binary file not shown.
16
Zimmermann, Sascha/PTP1/Eingabe.java
Normal file
16
Zimmermann, Sascha/PTP1/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!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/J04A1.class
Normal file
BIN
Zimmermann, Sascha/PTP1/J04A1.class
Normal file
Binary file not shown.
24
Zimmermann, Sascha/PTP1/J04A1.java
Normal file
24
Zimmermann, Sascha/PTP1/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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/J05A2.class
Normal file
BIN
Zimmermann, Sascha/PTP1/J05A2.class
Normal file
Binary file not shown.
36
Zimmermann, Sascha/PTP1/J05A2.java
Normal file
36
Zimmermann, Sascha/PTP1/J05A2.java
Normal file
@@ -0,0 +1,36 @@
|
||||
import java.util.Arrays;
|
||||
public class J05A2 {
|
||||
public static void main(String args[]){
|
||||
int zahlen[] = {13, 9, 67, 42, 101, 99, 97, 112, 83, 5, 78};
|
||||
|
||||
|
||||
|
||||
// a)
|
||||
for (int i = 0; i < zahlen.length; i++) {
|
||||
System.out.println("Zahl Nr. " + (i+1) + " lautet " + zahlen[i]);
|
||||
}
|
||||
|
||||
for (int zahl: zahlen ) {
|
||||
System.out.println(zahl);
|
||||
}
|
||||
|
||||
// b)
|
||||
for (int i = 0; i < zahlen.length; i++) {
|
||||
if (i < zahlen.length - 1) {
|
||||
System.out.print(zahlen[i] + " - ");
|
||||
} else {
|
||||
System.out.println(zahlen[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// c)
|
||||
Arrays.sort(zahlen);
|
||||
for (int zahl: zahlen ) {
|
||||
System.out.println(zahl);
|
||||
}
|
||||
|
||||
System.out.println("Kleinstes Element: " + zahlen[0]);
|
||||
System.out.println("Größtes Element: " + zahlen[zahlen.length - 1]);
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Kraftstoffverbrauch.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Kraftstoffverbrauch.class
Normal file
Binary file not shown.
13
Zimmermann, Sascha/PTP1/Kraftstoffverbrauch.java
Normal file
13
Zimmermann, Sascha/PTP1/Kraftstoffverbrauch.java
Normal file
@@ -0,0 +1,13 @@
|
||||
public class Kraftstoffverbrauch {
|
||||
public static void main(String args[]){
|
||||
double gefahreneKm = 437;
|
||||
double verbrauchterKraftstoff = 28.9;
|
||||
|
||||
double verbrauch100Km = (verbrauchterKraftstoff / gefahreneKm) * 100;
|
||||
|
||||
System.out.println("Gefahrene KM: " + gefahreneKm);
|
||||
System.out.println("Verbrauchter Kraftstoff: " + verbrauchterKraftstoff +" Liter");
|
||||
System.out.println("Verbrauch je 100km: " + verbrauch100Km + " Liter je 100Km");
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Lottozahlen.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Lottozahlen.class
Normal file
Binary file not shown.
60
Zimmermann, Sascha/PTP1/Lottozahlen.java
Normal file
60
Zimmermann, Sascha/PTP1/Lottozahlen.java
Normal file
@@ -0,0 +1,60 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Lottozahlen {
|
||||
public static void main(String args[]){
|
||||
int lottozahlen[] = {17, 9, 39, 23, 41, 6};
|
||||
//Scanner eingabe = new Scanner(System.in);
|
||||
|
||||
/*
|
||||
int lottozahlen[] = new int[6];
|
||||
lottozahlen[0] = eingabe.nextInt();
|
||||
lottozahlen[1] = eingabe.nextInt();
|
||||
lottozahlen[2] = eingabe.nextInt();
|
||||
lottozahlen[3] = eingabe.nextInt();
|
||||
lottozahlen[4] = eingabe.nextInt();
|
||||
lottozahlen[5] = eingabe.nextInt();
|
||||
*/
|
||||
|
||||
System.out.println("Die heutigen Lottozahlen sind " + lottozahlen);
|
||||
System.out.println("Es sind " + lottozahlen.length + " Lottozahlen gezogen worden.");
|
||||
System.out.println("Die erste Lottozahl lautet: " + lottozahlen[0]);
|
||||
System.out.println("Die zweite Lottozahl lautet: " + lottozahlen[1]);
|
||||
System.out.println("Die dritte Lottozahl lautet: " + lottozahlen[2]);
|
||||
System.out.println("Die vierte Lottozahl lautet: " + lottozahlen[3]);
|
||||
System.out.println("Die fünfte Lottozahl lautet: " + lottozahlen[4]);
|
||||
System.out.println("Die sechste Lottozahl lautet: " + lottozahlen[5]);
|
||||
|
||||
System.out.println("- - - - - - - - - - - - - - - - - - -");
|
||||
|
||||
//lottozahlen[3] = 32;
|
||||
System.out.println("Die vierte Lottozahl lautet: " + lottozahlen[3]);
|
||||
|
||||
System.out.println("- - - - - - - - - - - - - - - - - - -");
|
||||
|
||||
for (int i = 0; i < lottozahlen.length; i++) {
|
||||
System.out.println("Lottozahl Nr. " + (i + 1) + " lautet " + lottozahlen[i]);
|
||||
}
|
||||
|
||||
System.out.println("- - - - - - - - - - - - - - - - - - -");
|
||||
|
||||
for (int zahl: lottozahlen) {
|
||||
System.out.println("Die aktuelle Lottozahl lautet: " + zahl);
|
||||
}
|
||||
|
||||
System.out.println("- - - - - - - - - - - - - - - - - - -");
|
||||
|
||||
Arrays.sort(lottozahlen);
|
||||
|
||||
System.out.println("Die erste Lottozahl lautet: " + lottozahlen[0]);
|
||||
System.out.println("Die zweite Lottozahl lautet: " + lottozahlen[1]);
|
||||
System.out.println("Die dritte Lottozahl lautet: " + lottozahlen[2]);
|
||||
System.out.println("Die vierte Lottozahl lautet: " + lottozahlen[3]);
|
||||
System.out.println("Die fünfte Lottozahl lautet: " + lottozahlen[4]);
|
||||
System.out.println("Die sechste Lottozahl lautet: " + lottozahlen[5]);
|
||||
|
||||
System.out.println("- - - - - - - - - - - - - - - - - - -");
|
||||
|
||||
System.out.println("Die heutigen Lottozahlen sind: " + Arrays.toString(lottozahlen));
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/MeinErstesProgramm.class
Normal file
BIN
Zimmermann, Sascha/PTP1/MeinErstesProgramm.class
Normal file
Binary file not shown.
5
Zimmermann, Sascha/PTP1/MeinErstesProgramm.java
Normal file
5
Zimmermann, Sascha/PTP1/MeinErstesProgramm.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class MeinErstesProgramm{
|
||||
public static void main(String args[]){
|
||||
System.out.println("Hallo Welt!");
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Monat.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Monat.class
Normal file
Binary file not shown.
32
Zimmermann, Sascha/PTP1/Monat.java
Normal file
32
Zimmermann, Sascha/PTP1/Monat.java
Normal file
@@ -0,0 +1,32 @@
|
||||
public class Monat {
|
||||
public static void main(String args[]){
|
||||
|
||||
int monat = 7;
|
||||
|
||||
|
||||
switch (monat) {
|
||||
case 1:
|
||||
System.out.println("Januar");
|
||||
break;
|
||||
case 2:
|
||||
System.out.println("Februar");
|
||||
break;
|
||||
case 3:
|
||||
System.out.println("März");
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("April");
|
||||
break;
|
||||
case 5:
|
||||
System.out.println("Mai");
|
||||
break;
|
||||
case 6:
|
||||
System.out.println("Juni");
|
||||
break;
|
||||
default:
|
||||
System.out.println("Du hast keine gültige Monatszahl eingegeben!");
|
||||
} // end of switch
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
33
Zimmermann, Sascha/PTP1/Monat.~ava
Normal file
33
Zimmermann, Sascha/PTP1/Monat.~ava
Normal file
@@ -0,0 +1,33 @@
|
||||
public class Monat {
|
||||
public static void main(String args[]){
|
||||
|
||||
int monat = 7;
|
||||
|
||||
|
||||
switch (monat) {
|
||||
case 1:
|
||||
System.out.println("Januar");
|
||||
break;
|
||||
case 2:
|
||||
System.out.println("Februar");
|
||||
break;
|
||||
case 3:
|
||||
System.out.println("März");
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("April");
|
||||
break;
|
||||
case 5:
|
||||
System.out.println("Mai");
|
||||
break;
|
||||
case 6:
|
||||
System.out.println("Juni");
|
||||
break;
|
||||
default:
|
||||
System.out.println("Du hast keine gültige Monatszahl eingegeben!");
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/ProgExpr.class
Normal file
BIN
Zimmermann, Sascha/PTP1/ProgExpr.class
Normal file
Binary file not shown.
10
Zimmermann, Sascha/PTP1/ProgExpr.java
Normal file
10
Zimmermann, Sascha/PTP1/ProgExpr.java
Normal file
@@ -0,0 +1,10 @@
|
||||
public class ProgExpr {
|
||||
public static void main (String args[]) {
|
||||
int guthaben = 1000;
|
||||
System.out.println("Guthaben = " + guthaben);
|
||||
int einzahlung = 500;
|
||||
System.out.println("Einzahlung = " + einzahlung);
|
||||
guthaben = guthaben + einzahlung;
|
||||
System.out.println("Guthaben = " + guthaben);
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/ProgFor.class
Normal file
BIN
Zimmermann, Sascha/PTP1/ProgFor.class
Normal file
Binary file not shown.
13
Zimmermann, Sascha/PTP1/ProgFor.java
Normal file
13
Zimmermann, Sascha/PTP1/ProgFor.java
Normal file
@@ -0,0 +1,13 @@
|
||||
public class ProgFor {
|
||||
public static void main (String args[]) {
|
||||
int guthaben = 1000;
|
||||
int einzahlung = 500;
|
||||
System.out.println("Guthaben = " + guthaben);
|
||||
System.out.println("Einzahlung = " + einzahlung + " pro Monat");
|
||||
for ( int monat=1; monat<=6; monat = monat + 1 ) {
|
||||
guthaben = guthaben + einzahlung;
|
||||
System.out.println(monat + ". Monat:");
|
||||
System.out.println(" Guthaben = " + guthaben);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/ProgIf.class
Normal file
BIN
Zimmermann, Sascha/PTP1/ProgIf.class
Normal file
Binary file not shown.
9
Zimmermann, Sascha/PTP1/ProgIf.java
Normal file
9
Zimmermann, Sascha/PTP1/ProgIf.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class ProgIf {
|
||||
public static void main (String args[]) {
|
||||
int guthaben = 50000;
|
||||
System.out.println("Guthaben = " + guthaben);
|
||||
if ( guthaben >= 1000000 ) {
|
||||
System.out.println("Gratuliere, Du bist Millionaer!");
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Zimmermann, Sascha/PTP1/ProgIf.~ava
Normal file
9
Zimmermann, Sascha/PTP1/ProgIf.~ava
Normal file
@@ -0,0 +1,9 @@
|
||||
public class ProgIf {
|
||||
public static void main (String args[]) {
|
||||
int guthaben = 50000;
|
||||
System.out.println("Guthaben = " + guthaben);
|
||||
if ( guthaben >= 1000000 ) {
|
||||
System.out.println("Gratuliere, Du bist Millionaer!");
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/ProgWhile.class
Normal file
BIN
Zimmermann, Sascha/PTP1/ProgWhile.class
Normal file
Binary file not shown.
14
Zimmermann, Sascha/PTP1/ProgWhile.java
Normal file
14
Zimmermann, Sascha/PTP1/ProgWhile.java
Normal file
@@ -0,0 +1,14 @@
|
||||
public class ProgWhile {
|
||||
public static void main (String args[]) {
|
||||
int guthaben = 1000;
|
||||
int sparziel = 8000;
|
||||
int einzahlung = 600;
|
||||
System.out.println ("Guthaben = " + guthaben);
|
||||
System.out.println ("Sparziel = " + sparziel);
|
||||
while ( guthaben < sparziel ) {
|
||||
guthaben = guthaben + einzahlung;
|
||||
System.out.println ("neues Guthaben = " + guthaben);
|
||||
}
|
||||
System.out.println( "Sparziel erreicht.");
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Quadratzahlen.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Quadratzahlen.class
Normal file
Binary file not shown.
8
Zimmermann, Sascha/PTP1/Quadratzahlen.java
Normal file
8
Zimmermann, Sascha/PTP1/Quadratzahlen.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Quadratzahlen{
|
||||
public static void main(String args[]) {
|
||||
for (int i = 1; i <= 20 ; i++ ) {
|
||||
int quadrat = i * i;
|
||||
System.out.println("Die Quadratzahl von " + i + " lautet " + quadrat);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Sparbuch.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Sparbuch.class
Normal file
Binary file not shown.
11
Zimmermann, Sascha/PTP1/Sparbuch.java
Normal file
11
Zimmermann, Sascha/PTP1/Sparbuch.java
Normal file
@@ -0,0 +1,11 @@
|
||||
public class Sparbuch{
|
||||
public static void main(String args[]){
|
||||
double guthaben = 1000;
|
||||
double zinssatz = 1.5/100;
|
||||
|
||||
for (int jahr = 1; jahr <= 25 ; jahr++ ) {
|
||||
guthaben = guthaben + guthaben * zinssatz;
|
||||
System.out.println("Guthaben im " + jahr + ". Jahr: " + guthaben);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Steigung.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Steigung.class
Normal file
Binary file not shown.
21
Zimmermann, Sascha/PTP1/Steigung.java
Normal file
21
Zimmermann, Sascha/PTP1/Steigung.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Steigung {
|
||||
public static void main (String args[]){
|
||||
// Koordinaten x1 und y1 von Punkt P
|
||||
// P(x1 | y1)
|
||||
double x1 = 4;
|
||||
double y1 = 6;
|
||||
|
||||
// Koordinaten x2 und y2 von Punkt Q
|
||||
// Q(x2 | y2)
|
||||
double x2 = 2;
|
||||
double y2 = 1;
|
||||
|
||||
// m = (y2 - y1) / (x2 - x1)
|
||||
double m = (y2 - y1) / (x2 - x1);
|
||||
|
||||
System.out.println("P(" + x1 + " | " + y1 + ")");
|
||||
System.out.println("Q(" + x2 + " | " + y2 + ")");
|
||||
System.out.println("Steigung zwischen P und Q: " + m);
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Variablen.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Variablen.class
Normal file
Binary file not shown.
9
Zimmermann, Sascha/PTP1/Variablen.java
Normal file
9
Zimmermann, Sascha/PTP1/Variablen.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Variablen{
|
||||
public static void main(String args[]){
|
||||
int zahl = 3;
|
||||
double zahlD = (double) zahl;
|
||||
|
||||
System.out.println("Int: " + zahl + ", Double: " + zahlD);
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/VariablenTest.class
Normal file
BIN
Zimmermann, Sascha/PTP1/VariablenTest.class
Normal file
Binary file not shown.
12
Zimmermann, Sascha/PTP1/VariablenTest.java
Normal file
12
Zimmermann, Sascha/PTP1/VariablenTest.java
Normal file
@@ -0,0 +1,12 @@
|
||||
public class VariablenTest{
|
||||
public static void main(String args[]){
|
||||
int zaehler = 3;
|
||||
double zaehlerD = (double) zaehler;
|
||||
double bruch = zaehler / 3.14;
|
||||
|
||||
final double pi = 3.1415;
|
||||
|
||||
System.out.println("Zaehler: " + zaehler + ", ZaehlerD: " + zaehlerD);
|
||||
System.out.println("Bruch: " + bruch + ", Pi: " + pi);
|
||||
}
|
||||
}
|
||||
12
Zimmermann, Sascha/PTP1/VariablenTest.~ava
Normal file
12
Zimmermann, Sascha/PTP1/VariablenTest.~ava
Normal file
@@ -0,0 +1,12 @@
|
||||
public class VariablenTest{
|
||||
public static void main(String args[]){
|
||||
int zaehler = 3;
|
||||
double zaehlerD = (double) zaehler;
|
||||
double bruch = zaehler / 3.14;
|
||||
|
||||
final double pi = 3.1415;
|
||||
|
||||
System.out.print("Zaehler: " + zaehler + ", ZaehlerD: " + zaehlerD);
|
||||
System.out.println("Bruch: " + bruch + ", Pi: " + pi);
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/Verzweigung.class
Normal file
BIN
Zimmermann, Sascha/PTP1/Verzweigung.class
Normal file
Binary file not shown.
25
Zimmermann, Sascha/PTP1/Verzweigung.java
Normal file
25
Zimmermann, Sascha/PTP1/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!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/VerzweigungSwitch.class
Normal file
BIN
Zimmermann, Sascha/PTP1/VerzweigungSwitch.class
Normal file
Binary file not shown.
30
Zimmermann, Sascha/PTP1/VerzweigungSwitch.java
Normal file
30
Zimmermann, Sascha/PTP1/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
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Zimmermann, Sascha/PTP1/lottoArray.class
Normal file
BIN
Zimmermann, Sascha/PTP1/lottoArray.class
Normal file
Binary file not shown.
10
Zimmermann, Sascha/PTP1/lottoArray.java
Normal file
10
Zimmermann, Sascha/PTP1/lottoArray.java
Normal file
@@ -0,0 +1,10 @@
|
||||
import java.util.Arrays;
|
||||
public class lottoArray{
|
||||
public static void main(String args[]){
|
||||
int lottozahlen[] = {17, 9, 39, 23, 41, 6};
|
||||
System.out.println("Anzahl Elemente im Array: " + lottozahlen.length);
|
||||
System.out.println("Komplettes Array: " + Arrays.toString(lottozahlen));
|
||||
Arrays.sort(lottozahlen);
|
||||
System.out.println("Komplettes Array: " + Arrays.toString(lottozahlen));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user