From 9252ec44b7250604457a7c006cc6f6ff35f9b615 Mon Sep 17 00:00:00 2001 From: obai Date: Wed, 2 Oct 2024 22:55:19 +0200 Subject: [PATCH] Shop --- .../Login_Student.java | 8 +-- .../VorlesungsFolien/Verebung/OnlineShop.odt | Bin 0 -> 18162 bytes .../src/Übungen/OnlineShop/Kunde.java | 38 +++++++++++ .../src/Übungen/OnlineShop/Main.java | 13 ++++ .../src/Übungen/OnlineShop/Produkt.java | 63 ++++++++++++++++++ .../OnlineShop/ProduktNotFoundException.java | 9 +++ .../src/Übungen/OnlineShop/Shop.java | 30 +++++++++ .../src/Übungen/OnlineShop/Warenkorb.java | 44 ++++++++++++ .../src/Übungen/OnlineShop/produkte.csv | 7 ++ 9 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 Programmierung2/src/VorlesungsFolien/Verebung/OnlineShop.odt create mode 100644 Programmierung2/src/Übungen/OnlineShop/Kunde.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/Main.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/Produkt.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/ProduktNotFoundException.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/Shop.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/Warenkorb.java create mode 100644 Programmierung2/src/Übungen/OnlineShop/produkte.csv diff --git a/Programmierung2/src/GUIAnwendungen/StudentManagementSystem/Login_Student.java b/Programmierung2/src/GUIAnwendungen/StudentManagementSystem/Login_Student.java index a59d398..37c0c0d 100644 --- a/Programmierung2/src/GUIAnwendungen/StudentManagementSystem/Login_Student.java +++ b/Programmierung2/src/GUIAnwendungen/StudentManagementSystem/Login_Student.java @@ -13,6 +13,7 @@ import javax.swing.JToggleButton; import javax.swing.JList; import javax.swing.AbstractListModel; import javax.swing.JRadioButton; +import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; public class Login_Student extends JFrame { @@ -25,7 +26,7 @@ public class Login_Student extends JFrame { private JTextField einagbeGeburtstag; private JTextField eingabeTeleN; private JTextField eingabeAdresse; - + static JScrollPane listScrollPane = new JScrollPane(); /** * Launch the application. */ @@ -126,10 +127,7 @@ public class Login_Student extends JFrame { eingabeAdresse.setBounds(118, 249, 114, 21); panel.add(eingabeAdresse); - JList list = new JList(); - list.setValueIsAdjusting(true); - list.setBounds(127, 169, 1, 1); - panel.add(list); + JList geshlechtAuswaehlen = new JList(); geshlechtAuswaehlen.setToolTipText(""); diff --git a/Programmierung2/src/VorlesungsFolien/Verebung/OnlineShop.odt b/Programmierung2/src/VorlesungsFolien/Verebung/OnlineShop.odt new file mode 100644 index 0000000000000000000000000000000000000000..9ce8277504bf3a577ede64dddb2447083c0d5806 GIT binary patch literal 18162 zcmb`v1#lh7k~J(_7FjGy7Bg7P%xEz)v#cv-W@ct)W@cuzn3KhOc(68Tn6_6>wRNuzYLSNg$ z!UUkJZ38ejqp~y8qcqpH23S*?Tj-nVnd{n`>YLe6+UPsjNc{!uUH@N#@m}IHH!}eI zu(kRP#+sH&TUS@#MF0KL+=}X-HL?Fj6JVJ3-iTtTifNS?X?&EW~&;)PbIPGWhJI{O)%qq5n0;h3)4=?c1DY7(|zVaWXKHRH0^clC^n~J!WRKvx!@C4 zwC9$C+a&e)poRFjQZCrf!)f|)qf|5zstkojM5UFsY&J2g<4qPs5 z4~H*BG%l>aSgO%bCJ!=W8A$eCP)|Szhut3wPmHW6OT%!+teQa{>5WqYPhZt{AdDg@ zw6u}yhZ}+iE2V*I>MJ8VkNg;CBFFVE8vxHM(@EM6b?Q=53W$jD5Gz@9ocx{|d;N9P z_I$Q90@Ztlh7STpHbv^$!($0Ps)IlmIx)u%LlYUsLcm`R%po*BGP{M=!-`#w^0BKgLR0p5jM~ z{m{8MHFwu^abh}9OShERrR3e*bZmKoz?Ke#!C~s|j&r2-_P2k5Xfuc`Qg)eCbb+jg1EL1CR4J}o>&l_oNV)qT~p}{u%Ns| zRL8~Qnl^}sZzDkkgJRm}!3AU}G6a2()U{G`P1B#I6;j0{KxnzpJ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|X)i^y zlhWx#PcSxpZVBdsn%ZyT9ms&iNdYj4#@6pnc8I`4xWGvLwtXX`jmh4#%8lZ4s^!nF zV^|)QdfH%q4eWS1J#6${0@FW~YlV&f#%2PDX4m}oSsYuk@CnzKD1aHWG5Z$g6Wfdz z%41^Hm$$aZ*WY5!}F|D12)ul@g_`R{qUZKcwfq`0r-@IUmJ896Bj z{5zyS<+u1}oWG6>;p6|DpFi?l{1?ja;h298)coc2_J;_)qx_No;`c}RcfCJHDE@M% z|3ix3!xI0s-n<8O{=4R%V>Et6F#aKj??AeL#54Z8;-7u{e}!=TA$adE{60~CUOj%T$$tnK&p)itQlcR5F)Tnp Q@b7>6?~9H-@2{)>58UU5y#N3J literal 0 HcmV?d00001 diff --git a/Programmierung2/src/Übungen/OnlineShop/Kunde.java b/Programmierung2/src/Übungen/OnlineShop/Kunde.java new file mode 100644 index 0000000..ac61c38 --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/Kunde.java @@ -0,0 +1,38 @@ +package Übungen.OnlineShop; + +public class Kunde { + + private int id; + private String name; + private Warenkorb warenkorb; + + public Kunde(int id, String name, Warenkorb warenkorb) { + super(); + this.id = id; + this.name = name; + this.warenkorb = warenkorb; + + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Kunde [id=" + id + ", name=" + name + "]"; + } + +} diff --git a/Programmierung2/src/Übungen/OnlineShop/Main.java b/Programmierung2/src/Übungen/OnlineShop/Main.java new file mode 100644 index 0000000..6c948a1 --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/Main.java @@ -0,0 +1,13 @@ +package Übungen.OnlineShop; + +import java.io.FileNotFoundException; + +public class Main { + + public static void main(String[] args) throws FileNotFoundException { + Shop shop = new Shop(); + + + } + +} diff --git a/Programmierung2/src/Übungen/OnlineShop/Produkt.java b/Programmierung2/src/Übungen/OnlineShop/Produkt.java new file mode 100644 index 0000000..6f79212 --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/Produkt.java @@ -0,0 +1,63 @@ +package Übungen.OnlineShop; + +public class Produkt { + private String name; + private String beschreibung; + private double preis; + private int gewicht; + private int bestand; + + public Produkt(String name, String beschreibung, double preis, int gewicht, int bestand) { + super(); + this.name = name; + this.beschreibung = beschreibung; + this.preis = preis; + this.gewicht = gewicht; + this.bestand = bestand; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getBeschreibung() { + return beschreibung; + } + + public void setBeschreibung(String beschreibung) { + this.beschreibung = beschreibung; + } + + public double getPreis() { + return preis; + } + + public void setPreis(double preis) { + this.preis = preis; + } + + public int getGewicht() { + return gewicht; + } + + public void setGewicht(int gewicht) { + this.gewicht = gewicht; + } + + public int getBestand() { + return bestand; + } + + public void setBestand(int bestand) { + this.bestand = bestand; + } + + + + + +} \ No newline at end of file diff --git a/Programmierung2/src/Übungen/OnlineShop/ProduktNotFoundException.java b/Programmierung2/src/Übungen/OnlineShop/ProduktNotFoundException.java new file mode 100644 index 0000000..9103008 --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/ProduktNotFoundException.java @@ -0,0 +1,9 @@ +package Übungen.OnlineShop; + +public class ProduktNotFoundException extends Exception { + + ProduktNotFoundException(String nachricht){ + super(nachricht); + } + +} diff --git a/Programmierung2/src/Übungen/OnlineShop/Shop.java b/Programmierung2/src/Übungen/OnlineShop/Shop.java new file mode 100644 index 0000000..f84d2ae --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/Shop.java @@ -0,0 +1,30 @@ +package Übungen.OnlineShop; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Scanner; + +public class Shop { + + ArrayList produkte; + ArrayList kunde; + ArrayList warenkorb; + + Shop() throws FileNotFoundException { + this.produkte = new ArrayList<>(); + this.kunde = new ArrayList<>(); + this.warenkorb = new ArrayList<>(); + addProdukte(); + } + + public void addProdukte() throws FileNotFoundException { + File fr = new File("/home/obai/git/Programmierung2/Programmierung2/src/Übungen/OnlineShop/produkte.csv"); + Scanner scan = new Scanner(fr); + while (scan.hasNextLine()) + System.out.println(scan.nextLine()); + } + + + +} diff --git a/Programmierung2/src/Übungen/OnlineShop/Warenkorb.java b/Programmierung2/src/Übungen/OnlineShop/Warenkorb.java new file mode 100644 index 0000000..1b8c9ce --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/Warenkorb.java @@ -0,0 +1,44 @@ +package Übungen.OnlineShop; + +import java.util.ArrayList; + +public class Warenkorb { + private ArrayList produkte; + + public Warenkorb(ArrayList produkte) { + super(); + this.produkte = produkte; + } + + public void addProdukt(Produkt p) throws ProduktNotFoundException { + if (p == null) + throw new ProduktNotFoundException("Falsche Eingabe"); + + this.produkte.add(p); + } + + public void removeProdukt(Produkt p) throws ProduktNotFoundException { + + for (Produkt pr: produkte) + if (!pr.equals(p)) + throw new ProduktNotFoundException("Dieser Produkt ist bereits nicht im Warenkorb"); + + produkte.remove(p); + } + + public double gesamtPreisBerechnen() throws ProduktNotFoundException { + + if (produkte.size() == 0) + throw new ProduktNotFoundException("Sie haben keine Artikel "); + + double gesamtPreis = 0; + + for (Produkt pr: produkte) + gesamtPreis += pr.getPreis(); + + return gesamtPreis; + } + + + +} diff --git a/Programmierung2/src/Übungen/OnlineShop/produkte.csv b/Programmierung2/src/Übungen/OnlineShop/produkte.csv new file mode 100644 index 0000000..a3a74dd --- /dev/null +++ b/Programmierung2/src/Übungen/OnlineShop/produkte.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