commit d3b28c90193f8e202e7425cef31c958017b8f8e5 Author: BretschneiderMarvin <81246475+BretschneiderMarvin@users.noreply.github.com> Date: Tue Mar 28 10:03:40 2023 +0200 first Commit diff --git a/Faktur2/src/ConfigDatei.java b/Faktur2/src/ConfigDatei.java new file mode 100644 index 0000000..58b2435 --- /dev/null +++ b/Faktur2/src/ConfigDatei.java @@ -0,0 +1,46 @@ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Scanner; + +public class ConfigDatei { + + private String firmenname = "Firma1"; + private String Firmenadresse; + private String Bankverbindung; + private static String configFile = "config.cfg"; + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + File tmpFile = new File(configFile); + boolean exists = tmpFile.exists(); + if (exists = false) { + try { + FileWriter fw = new FileWriter(configFile); + System.out.println("Bitte geben sie Ihren Firmennamen ein: "); + String name = sc.nextLine(); + System.out.println("Bitte geben sie Ihre Firmenadresse ein: "); + String adresse = sc.nextLine(); + System.out.println("Bitte geben sie Ihre Bankverbindung ein: "); + String bankverbindung = sc.nextLine(); + char quote = '"'; + fw.write("Firmenname: " + quote + name); + fw.write("Firmenadresse: " +quote +adresse); + fw.write("Bankverbindung: " +); + + } catch (IOException e) { + e.printStackTrace(); + } + +} + + else{ + BufferedReader br= new BufferedReader(new FileReader(configFile)); + br.read(); + }} + +}