small improvements

This commit is contained in:
Sebastian Brosch 2024-05-06 13:13:58 +02:00
parent 9dee87f32f
commit 163c2d428e
2 changed files with 16 additions and 3 deletions

View File

@ -1,11 +1,13 @@
package VL12.Aufgabe01;
import java.io.File;
import java.io.FileWriter;
import java.util.Random;
/**
* Vorlesung 12 - Ein- und Ausgabe - Aufgabe 1
* @author Sebastian Brosch
* @see https://gitea.hb.dhbw-stuttgart.de/sebastianbrosch/VL-Programmieren/src/branch/main/VL12/Aufgabe01
*/
public class Aufgabe01 {
public static void main(String[] args) {
@ -33,9 +35,19 @@ public class Aufgabe01 {
StringFeld postleitzahlen = new StringFeld(getPathFromPackage() + "/input/PLZOrt.TXT", " ", 0);
StringFeld orte = new StringFeld(getPathFromPackage() + "/input/PLZOrt.TXT", " ", 1);
// create missing output folder.
final String folderOutput = getPathFromPackage() + "/output/";
final File fileOutputFixedWidth = new File(folderOutput + "output-fixed-width.txt");
final File fileOutputSeparator = new File(folderOutput + "output-separator.txt");
final File parentFolder = fileOutputFixedWidth.getParentFile();
if(null != parentFolder) {
parentFolder.mkdirs();
}
try {
FileWriter outputFixedWidth = new FileWriter(getPathFromPackage() + "/output/output-fixed-width.txt");
FileWriter outputSeparator = new FileWriter(getPathFromPackage() + "/output/output-separator.txt");
FileWriter outputFixedWidth = new FileWriter(fileOutputFixedWidth);
FileWriter outputSeparator = new FileWriter(fileOutputSeparator);
for(int i = 0; i < cntDataSets; i++) {
int kundennummer = START_KUNDENNUMMER + i;
@ -67,7 +79,7 @@ public class Aufgabe01 {
outputSeparator.close();
} catch(Throwable e) {;}
System.out.println("Die Testdaten wurden erzeugt.");
System.out.println("Die Testdaten (" + cntDataSets + " Zeilen) wurden erzeugt.");
}
/**

View File

@ -9,6 +9,7 @@ import java.nio.file.Paths;
/**
* Vorlesung 12 - Ein- und Ausgabe - Aufgabe 2
* @author Sebastian Brosch
* @see https://gitea.hb.dhbw-stuttgart.de/sebastianbrosch/VL-Programmieren/src/branch/main/VL12/Aufgabe02
*/
public class Aufgabe02 {
public static void main(String[] args) {