diff --git a/.idea/OnlineShop.iml b/.idea/OnlineShop.iml
index c90834f..0ad395b 100644
--- a/.idea/OnlineShop.iml
+++ b/.idea/OnlineShop.iml
@@ -7,5 +7,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Bestellung.java b/src/Bestellung.java
index ca8a0c4..b4de78c 100644
--- a/src/Bestellung.java
+++ b/src/Bestellung.java
@@ -17,13 +17,24 @@ double gesamtPreis;
this.versandkosten = versandkosten;
this.anteil7 = anteil7;
this.anteil19 = anteil19;
- this.gesamtPreis = gesamtPreis;
+ if(gesamtPreis >= 500.0) {
+ this.gesamtPreis = gesamtPreis - versandkosten;}
+ else {
+ this.gesamtPreis = gesamtPreis;
+ }
}
public void bestellbestätigung(){
System.out.println("Bestellungbestätigung: \n" + name);
- System.out.println("Der Gesamt Preis ihrer Bestellung berträgt " + (gesamtPreis) + "€, davon " + versandkosten +"€ Versandkosten");
- System.out.println(" (inkl. MwSt. 7%: " + anteil7 + " , MwSt. 19%: " + anteil19 + "€, Netto: " + (versandkosten-(anteil7 + anteil19)) + "€ \n");
+ System.out.println("Der Gesamt Preis ihrer Bestellung berträgt ");
+ if(gesamtPreis >= 500.0) {
+ gesamtPreis -= versandkosten;
+ System.out.print(gesamtPreis + "€, und das Versankostenfrei, da Ihre Bestellung über 500€ kostet\n");
+ }
+ else {
+ System.out.print(gesamtPreis + "€, davon " + versandkosten + " Versandkosten");
+ System.out.println(" (inkl. MwSt. 7%: " + anteil7 + " , MwSt. 19%: " + anteil19 + "€, Netto: " + (versandkosten - (anteil7 + anteil19)) + "€ \n");
+ }
System.out.println("Ihre Bestellung wurde erflogreich aufgenommen und wird an " + adresse + " geliefert.");
System.out.println("Die Bestellung wird in 5-7 Werktagen bei Ihnen eintreffen. \nVielen Dank für Ihre Bestellung!");
diff --git a/src/BestellungTest.java b/src/BestellungTest.java
new file mode 100644
index 0000000..d1079e6
--- /dev/null
+++ b/src/BestellungTest.java
@@ -0,0 +1,14 @@
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+public class BestellungTest {
+
+ @Test
+ void testBestellung(){
+ Bestellung bestellung = new Bestellung("Igor", "Strasse", 19.95, 0.5, 0.9, 520);
+
+ assertEquals(500.05, bestellung.gesamtPreis);
+
+ }
+}
diff --git a/src/ProduktTest.java b/src/ProduktTest.java
new file mode 100644
index 0000000..c5e0001
--- /dev/null
+++ b/src/ProduktTest.java
@@ -0,0 +1,36 @@
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+public class ProduktTest {
+
+
+
+ @Test
+
+ void testConstructor(){
+ Produkt produkt1 = new Produkt(1, "IPhone", 0.7, 649.99, 19, 2);
+ Produkt produkt2 = new Produkt(2, "MacBook", 8.5, 829.99, 19, 5);
+
+ assertEquals(1, produkt1.getProduktNr());
+ assertEquals(2, produkt2.getProduktNr());
+
+ assertEquals("IPhone", produkt1.getName());
+ assertEquals("MacBook", produkt2.getName());
+
+ assertEquals(0.7, produkt1.getGewicht());
+ assertEquals(8.5, produkt2.getGewicht());
+
+ assertEquals(649.99, produkt1.getPreis());
+ assertEquals(829.99, produkt2.getPreis());
+
+ assertEquals(19, produkt1.getMwSteuer());
+ assertEquals(19, produkt2.getMwSteuer());
+
+ assertEquals(2, produkt1.getLagerbestand());
+ assertEquals(5, produkt2.getLagerbestand());
+
+ assertEquals("1, IPhone, 0.7, 649.99, 19, 2", produkt1.toString());
+ assertEquals("2, MacBook, 8.5, 829.99, 19, 5", produkt2.toString());
+ }
+}