commit 42aae21ede94548abc339431f6b76cf4c18c0d89 Author: 3013050 <3013050@stud.hs-mannheim.de> Date: Mon Apr 15 11:14:14 2024 +0200 initial commit diff --git a/resources/productList.csv b/resources/productList.csv new file mode 100644 index 0000000..d0a6c6e --- /dev/null +++ b/resources/productList.csv @@ -0,0 +1,7 @@ +Name;Beschreibung;Preis;Gewicht;Bestand +Gieskanne;Premium Gärtner-Gieskanne;3,99;250,00;17,00 +Hut;Perfekt für die Hutablage;21,98;120,00;123,00 +Dosenwurst;LWWRSCHT: das Pfälzer Original, nur kurz im Angebot;3,99;200,00;7,00 +Gartenschlauch;10 m, dehnbar bis auf die doppelte Länge;18,99;1300,00;23,00 +Schraubenset;100 zufällig ausgewählte Schrauben;2,99;287,00;99,00 +Akkuschrauber;Mit extra großem Drehmoment;25,00;900,00;13,00 \ No newline at end of file diff --git a/shop/domain/Product.java b/shop/domain/Product.java new file mode 100644 index 0000000..92cb803 --- /dev/null +++ b/shop/domain/Product.java @@ -0,0 +1,37 @@ +package domain; + +public class Product { + private String name; + private String description; + private float price; + private int weight; + private int bestand; + + public Product(String name, String description, float price, int weight, int bestand) { + this.name = name; + this.description = description; + this.price = price; + this.weight = weight; + this.bestand = bestand; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public float getPrice() { + return price; + } + + public int getWeight() { + return weight; + } + + public int getBestand() { + return bestand; + } +} diff --git a/shop/fassade/OnlineShopSystem.java b/shop/fassade/OnlineShopSystem.java new file mode 100644 index 0000000..14db803 --- /dev/null +++ b/shop/fassade/OnlineShopSystem.java @@ -0,0 +1,31 @@ +package fassade; + +import domain.Product; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Scanner; + +public class OnlineShopSystem { + private ArrayList storage; + + public OnlineShopSystem(String filePath) throws FileNotFoundException { + storage = new ArrayList(); + + loadProducts(filePath); + } + + private void loadProducts(String filePath) throws FileNotFoundException { + Scanner sc = new Scanner(new File(filePath)); + + int counter = 0; + while (sc.hasNextLine()) { + String product = sc.nextLine(); + + + counter ++; + } + + } +} diff --git a/shop/tui/TUI.java b/shop/tui/TUI.java new file mode 100644 index 0000000..2566682 --- /dev/null +++ b/shop/tui/TUI.java @@ -0,0 +1,40 @@ +package tui; + +import fassade.OnlineShopSystem; + +import java.io.FileNotFoundException; +import java.util.Scanner; + +public class TUI { + + private OnlineShopSystem shop; + + private Scanner sc; + + public static void main(String[] args) { + + try { + new TUI(); + } catch ( FileNotFoundException e){ + // resources/productList.csv + System.out.printf("Storage list couldn't be loaded. \n"); + System.out.printf("Cancelling. \n\n"); + } + } + + public TUI () throws FileNotFoundException { + sc = new Scanner(System.in); + + String filePath = welcomeMessage(); + + shop = new OnlineShopSystem(filePath); + + + } + + private String welcomeMessage(){ + System.out.println("Welcome to the Bauhaus online shop!"); + System.out.print("Please input the product list location: "); + return sc.nextLine(); + } +}