From 5ebb89190dab08354d1605b951f49f7c001eb0e4 Mon Sep 17 00:00:00 2001 From: Oliver Hummel Date: Tue, 7 Nov 2023 17:49:33 +0100 Subject: [PATCH] Der UmsatzGenerator aus dem alten Git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Für die Analyse von CSV-Dateien. --- src/UmsatzGenerator.java | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/UmsatzGenerator.java diff --git a/src/UmsatzGenerator.java b/src/UmsatzGenerator.java new file mode 100644 index 0000000..00c118f --- /dev/null +++ b/src/UmsatzGenerator.java @@ -0,0 +1,44 @@ + import java.io.BufferedWriter; + import java.io.FileWriter; + import java.io.PrintWriter; + + public class UmsatzGenerator { + + public static void main(String[] args) throws Exception { + String[] standorte = {"Mannheim", "Heidelberg", "Schwetzingen", "Speyer", "Neustadt"}; + String[] produkte = {"Staubsaugerroboter", "NAO-Roboter", "Wischroboter", "Lego-Roboter", "Spielzeugroboter"}; + + double[] preise = {398.95, 8400.0, 289.0, 129.90, 49.99}; + int counter = 1; + + String jahr = "2019"; + + for (int i = 1; i <= 12; i++) { + + PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("/tmp/aufträge/" + jahr + "-" + i + ".csv"))); + + for (int j = 1; j < Math.random() * 500 + 200; j++) { + int tag = (int) (Math.random() * 12 + 1); + int standort = (int) (Math.random() * standorte.length); + int produkt = (int) (Math.random() * produkte.length); + int anzahl = (int) (Math.random() * 42 + 1); + + String knr = "" + (int) (Math.random() * 9999 + 1); + String kunde = "K" + "0000".substring(knr.length()) + knr; + + String anr = "A" + jahr + "00000".substring((""+counter).length()) + counter; + + pw.println(anr + "," + tag + "." + i + ".2019," + standorte[standort] + "," + kunde + "," + produkte[produkt] + "," + + anzahl + "," + preise[produkt]); + + counter++; + } + + pw.close(); + } + + System.out.println("done."); + + } + + }