initial commit
commit
42aae21ede
|
@ -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
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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<Product> storage;
|
||||
|
||||
public OnlineShopSystem(String filePath) throws FileNotFoundException {
|
||||
storage = new ArrayList<Product>();
|
||||
|
||||
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 ++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue