added README.md

This commit is contained in:
DH10RBH 2024-05-07 17:45:49 +02:00
parent 0bfc9fb5cf
commit 24c775587e
31 changed files with 2000536 additions and 11 deletions

29
Vl12 Afg1/.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

8
Vl12 Afg1/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

5
Vl12 Afg1/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,5 @@
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
Vl12 Afg1/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Vl12 Afg1.iml" filepath="$PROJECT_DIR$/Vl12 Afg1.iml" />
</modules>
</component>
</project>

6
Vl12 Afg1/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -7,18 +7,18 @@
70197 Stuttgart
70199 Stuttgart
70327 Stuttgart
72070 Tübingen
72072 Tübingen
72074 Tübingen
72076 Tübingen
72070 Tübingen
72072 Tübingen
72074 Tübingen
72076 Tübingen
72181 Starzach
72182 Eutingen
72184 Eutingen
72185 Empfingen
72186 Empfingen
72186 Weiherhof
72187 Vöhringen
72189 Vöhringen
72187 Vöhringen
72189 Vöhringen
72202 Nagold
72210 Altensteig
72213 Altensteig

View File

@ -5,7 +5,7 @@ Nelkenweg
Stuttgarter Str.
Ulmer Str.
Freiburger Str.
Münchner Str.
Münchner Str.
Goetheweg
Beethovenallee
Schillerstr.

11
Vl12 Afg1/Vl12 Afg1.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1000001
Vl12 Afg1/kunden_feste_breite.txt Normal file

File diff suppressed because it is too large Load Diff

1000001
Vl12 Afg1/kunden_trennzeichen.txt Normal file

File diff suppressed because it is too large Load Diff

131
Vl12 Afg1/src/Main.java Normal file
View File

@ -0,0 +1,131 @@
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Anzahl der Kunden, die generiert werden sollen
int konsoleneingabe = getKonsoleneingabe();
// Dateinamen für die Dateien mit Trennzeichen und fester Breite
String dateiMitTrennzeichen = "kunden_trennzeichen.txt";
String dateiMitFesterBreite = "kunden_feste_breite.txt";
// StringFeld-Objekt erstellen und Daten einlesen
StringFeld stringFeld = new StringFeld();
stringFeld.readData();
// Arrays für die Daten
String[] nachnamen = stringFeld.getNachnamen();
String[] vornamen = stringFeld.getVornamen();
String[] strassen = stringFeld.getStrassen();
String[] plzOrte = stringFeld.getPlzOrte();
// Startkundennummer
int kundennummer = 100000;
// Kundeninformationen in Dateien schreiben
try (PrintWriter trennzeichenWriter = new PrintWriter(new FileWriter(dateiMitTrennzeichen));
PrintWriter festeBreiteWriter = new PrintWriter(new FileWriter(dateiMitFesterBreite))) {
// Überschriftenzeile für Datei mit Trennzeichen
trennzeichenWriter.println("Kundennummer#Nachname#Vorname#Straße#Hausnummer#PLZOrt#Umsatz (Euro)");
// Überschriftenzeile für Datei mit fester Breite
festeBreiteWriter.printf("%-12s%-20s%-20s%-20s%-10s%-20s%-10s%n", "Kundennummer", "Nachname", "Vorname", "Straße", "Hausnummer", "PLZOrt", "Umsatz (Euro)");
// Kundeninformationen in beide Dateien schreiben
for (int j = 0; j < konsoleneingabe; j++) {
// Auswahl von Nachname, Vorname, Straße und PLZOrt --> geschieht der Reihe nach
String nachname = truncateString(nachnamen[j % nachnamen.length], 20);
String vorname = truncateString(vornamen[j % vornamen.length], 20);
String strasse = truncateString(strassen[j % strassen.length], 20);
String plzOrt = truncateString(plzOrte[j % plzOrte.length], 20);
// Zufällige Generierung von Hausnummer und Umsatz
Random random = new Random();
int randomHausnummer = random.nextInt(10000);
int randomUmsatz = random.nextInt(2001 - 500) + 500;
// Kundennummer erhöhen und in beide Dateien schreiben
int aktuelleKundennummer = kundennummer++;
trennzeichenWriter.printf("%d#%s#%s#%s#%d#%s#%d%n", aktuelleKundennummer, nachname, vorname, strasse, randomHausnummer, plzOrt, randomUmsatz);
festeBreiteWriter.printf("%-12d%-20s%-20s%-20s%-10d%-20s%-10d%n", aktuelleKundennummer, nachname, vorname, strasse, randomHausnummer, plzOrt, randomUmsatz);
}
System.out.println("Kundendaten wurden erfolgreich in die Dateien geschrieben: ");
System.out.println("- " + dateiMitTrennzeichen);
System.out.println("- " + dateiMitFesterBreite);
} catch (IOException e) {
e.printStackTrace();
}
}
// Methode zum Kürzen von Strings auf eine maximale Länge
private static String truncateString(String str, int maxLength) {
if (str.length() > maxLength) {
return str.substring(0, maxLength);
}
return str;
}
// Methode zur Eingabe der Anzahl der zu generierenden Datensätze über die Konsole
private static int getKonsoleneingabe() {
Scanner scanner = new Scanner(System.in);
System.out.print("Geben Sie die Anzahl der zu generierenden Datensätze ein: ");
return scanner.nextInt();
}
}
class StringFeld {
private String[] nachnamen;
private String[] vornamen;
private String[] strassen;
private String[] plzOrte;
// Konstruktor
public StringFeld() {
}
// Getter-Methoden
public String[] getNachnamen() {
return nachnamen;
}
public String[] getVornamen() {
return vornamen;
}
public String[] getStrassen() {
return strassen;
}
public String[] getPlzOrte() {
return plzOrte;
}
// Methode zum Einlesen der Daten aus den Textdateien
public void readData() {
nachnamen = readTextFileToArray("Nachnamen.TXT");
vornamen = readTextFileToArray("Vornamen.TXT");
strassen = readTextFileToArray("Strassen.TXT");
plzOrte = readTextFileToArray("PLZOrt.TXT");
}
// Methode zum Einlesen einer Textdatei in ein String-Array
private String[] readTextFileToArray(String fileName) {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return lines.toArray(new String[0]);
}
}

1
Vl12 Afg1/test.TXT Normal file
View File

@ -0,0 +1 @@
dies ist eine tesdatei, wenn dieser text ausgegeben wird ist alles super

29
Vl12 Afg2/.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

8
Vl12 Afg2/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
Vl12 Afg2/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
Vl12 Afg2/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Vl12 Afg2.iml" filepath="$PROJECT_DIR$/Vl12 Afg2.iml" />
</modules>
</component>
</project>

11
Vl12 Afg2/Vl12 Afg2.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

47
Vl12 Afg2/src/Main.java Normal file
View File

@ -0,0 +1,47 @@
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
// Dateiname
String fileName = "tokenizerTest.TXT";
// Zählervariablen für Zeichenketten und Zahlen
int stringCount = 0;
int numberCount = 0;
// Gesamtanzahl der gelesenen Tokens
int tokenCount = 0;
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
tokenCount++;
// Prüfen, ob das Token eine Zahl ist
try {
int number = Integer.parseInt(token);
System.out.println("ZAHL : " + number);
numberCount++;
} catch (NumberFormatException e) {
// Das Token ist keine Zahl, sondern eine Zeichenkette
System.out.println("ZEICHENKETTE : " + token);
stringCount++;
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
// Ausgabe der Statistik
System.out.println("Gelesene Zahlen : " + numberCount);
System.out.println("Gelesene Zeichenketten : " + stringCount);
System.out.println("Insgesamt gelesene Token : " + tokenCount);
}
}

View File

@ -0,0 +1 @@
Dieser Text hat 6 Worte und 2 Zahlen.

BIN
Vl13 Afg1.zip Normal file

Binary file not shown.

29
Vl13 Afg1/.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

8
Vl13 Afg1/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
Vl13 Afg1/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
Vl13 Afg1/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Vl13 Afg1.iml" filepath="$PROJECT_DIR$/Vl13 Afg1.iml" />
</modules>
</component>
</project>

11
Vl13 Afg1/Vl13 Afg1.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,77 @@
import java.util.Stack;
public class Anwendung {
public static void trennzeichen() {
System.out.println("===========================================");
}
public static void main(String[] args) {
//a
trennzeichen();
IntegerStack Istack = new IntegerStack();
System.out.println("Is the stack empty? " + Istack.isEmpty());
Istack.push(1);
Istack.push(2);
Istack.push(3);
Istack.push(4);
Istack.push(5);
System.out.println("Stack wurde befüllt: ");
Istack.print();
System.out.println(" ");
System.out.println("3 mal pop:");
System.out.println(Istack.pop());
System.out.println(Istack.pop());
System.out.println(Istack.pop());
System.out.println("\nIs the stack empty? " + Istack.isEmpty());
trennzeichen();
//b
trennzeichen();
GenericStack<Character> stack = new GenericStack<Character>();
System.out.println("Is the stack empty? " + stack.isEmpty());
stack.push('a');
stack.push('<');
stack.push('y');
stack.push('1');
stack.push('&');
System.out.println("Stack wurde befüllt: ");
stack.print();
System.out.println(" ");
System.out.println("3 mal pop:");
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println("\nIs the stack empty? " + stack.isEmpty());
trennzeichen();
//c
trennzeichen();
Stack Sstack = new Stack();
System.out.println("Is the stack empty? " + Sstack.isEmpty());
Sstack.push('a');
Sstack.push('1');
Sstack.push('2');
Sstack.push('o');
Sstack.push('f');
System.out.println("Stack wurde befüllt: ");
for (int j = Sstack.size()-1; j>=0; j--){ System.out.println(Sstack.get(j));}
System.out.println(" ");
System.out.println("3 mal pop:");
System.out.println(Sstack.pop());
System.out.println(Sstack.pop());
System.out.println(Sstack.pop());
System.out.println("\nIs the stack empty? " + Sstack.isEmpty());
trennzeichen();
}
}

View File

@ -0,0 +1,41 @@
import java.util.ArrayList;
//1b
public class GenericStack<T> {
private ArrayList<T> arr;
// Constructor to initialize the stack
public GenericStack() {
arr = new ArrayList<T>();
}
// Method to push an element onto the stack
public void push(T value) {
arr.add(value);
}
// Method to pop an element from the stack
public T pop() {
T value = arr.getLast();
arr.removeLast();
return value;
}
public void print(){
for (int i=arr.size()-1; i>=0; i--){
System.out.println(arr.get(i));
}
}
// Method to check if the stack is empty
public boolean isEmpty() {
return arr.isEmpty();
}
}

View File

@ -0,0 +1,38 @@
import java.util.ArrayList;
//1a
public class IntegerStack {
private ArrayList<Integer> arr;
// Constructor to initialize the stack
public IntegerStack() {
arr = new ArrayList<Integer>();
}
// Method to push an element onto the stack
public void push(int value) {
arr.add(value);
}
// Method to pop an element from the stack
public int pop() {
int value = arr.getLast();
arr.removeLast();
return value;
}
public void print(){
for (int i=arr.size()-1; i>=0; i--){
System.out.println(arr.get(i));
}
}
// Method to check if the stack is empty
public boolean isEmpty() {
return arr.isEmpty();
}
}

View File

@ -1,4 +0,0 @@
package VL12;
public class Anwendung {
}