Compare commits
51 Commits
1bc6ecd05e
...
master
Author | SHA1 | Date | |
---|---|---|---|
51e370ad33 | |||
f1fabad17d | |||
deeabfd2ad | |||
6ffc7a6868 | |||
7e507fa95c | |||
f35554f858 | |||
9663777e25 | |||
eeba57165b | |||
58ec030102 | |||
4baa3ef51b | |||
a44c87cf83 | |||
230202aa0a | |||
3df13417c7 | |||
d4a351a4e2 | |||
83af3a6066 | |||
d2f9ef49c9 | |||
d858ff8f8d | |||
95069e7d8d | |||
3c51ebbc21 | |||
644df46a7a | |||
19d36d3464 | |||
12a8806fb6 | |||
de77901f5a | |||
76d08d93da | |||
2d683b9cc6 | |||
739e973cf7 | |||
044f64635b | |||
487bdd8fe0 | |||
c526229de9 | |||
93bf389472 | |||
1b73582469 | |||
ad6c4dec56 | |||
0b119f6637 | |||
16ab1705f0 | |||
6d690410ec | |||
922345077b | |||
455e92a986 | |||
7d2b03d584 | |||
27b2186c87 | |||
bf8cf182db | |||
536d7fe1fb | |||
4b51db302e | |||
5f0191d6cd | |||
61ba486e4f | |||
eb249cb685 | |||
6f1b665c4c | |||
97a83dcc46 | |||
3a2e57d039 | |||
84ded9963a | |||
3d283c95cd | |||
a38bd2b59f |
10
.idea/runConfigurations.xml
generated
10
.idea/runConfigurations.xml
generated
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
34
menue.txt
34
menue.txt
@@ -1,14 +1,20 @@
|
||||
12.12.2022;Veganes Schnitzel;mit Kroketten, Gemüse und Soße;Vegan;;x;;;x;;;;;;x;;;;;;;;;;;
|
||||
12.12.2022;Waffel;mit Puderzucker;Dessert V;;;;;x;;;;;;;;x;;;;;;x;;;
|
||||
12.12.2022;Schnitzel;mit Kroketten, Gemüse und Soße;Fleisch;;;;;x;;;;;x;;;;x;;;;;;;;
|
||||
12.12.2022;Wackelpudding;mit Vanillesoße;Dessert;;;;;;;;;;;;;;;x;;;;;;;
|
||||
13.12.2022;Rote Linsen Curry;mit Süßkartoffeln;Vegan;;x;;x;;;;;x;;;x;;;;;;;;;;
|
||||
13.12.2022;Vegane Pancakes;mit Ahornsirup;Dessert V;;x;;x;;;;;x;;;x;;;x;;;;;;;
|
||||
13.12.2022;Gebratene Nudeln;mit Gemüse;Vegetarisch;;;;;;;;;x;;;;x;;;x;;x;;;;
|
||||
13.12.2022;Berliner;;Dessert;;;;;;;;;;;;;;;;;;;;;;
|
||||
14.12.2022;Bratkartoffeln;mit veganer Bratensoße;Vegan;;;;;;;;;;;;;;;;;;;;;;
|
||||
14.12.2022;Pudding;;Dessert V;;;;;;;;;;;;;;;;;;;;;;
|
||||
14.12.2022;Bratkartoffeln;mit Leberkäse und Ei;Fleisch;;;;;;;;;;;;;;;;;;;;;;
|
||||
14.12.2022;Pudding;mit Vanillesoße;Dessert;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15.12.2022;Bauerntopf;mit veganem Hack;Vegan;;;;;;;;;;;;;;;;;;;;;;
|
||||
15.12.2022;Bananenbrot;mit Datteln;DessertV;x;;;;;;;;;;;;;;;;;;;;;
|
||||
12.12.2022;Veganes Schnitzel;mit Kroketten und Gemüse;Vegan;x;;;;;;x;;;;x;;;;;;;x;;;;;x
|
||||
12.12.2022;Vegane Waffel;mit Puderzucker;Dessert V;;;x;;x;;;;;x;;;;;;;x;;;;;;x
|
||||
12.12.2022;Schnitzel;mit Kroketten, Gemüse und Soße;Fleisch;;;x;;;;;x;;;x;;;;;;;;x;;;;x
|
||||
12.12.2022;Wackelpudding;mit Vanillesoße;Dessert;;;x;;;;;x;;;;;;;;x;;;;;x;;x
|
||||
13.12.2022;Rote Linsen Curry;mit Süßkartoffeln;Vegan;;;x;;;;;;;;x;;;;;;x;;;;;;x
|
||||
13.12.2022;Vegane Pancakes;mit Ahornsirup;Dessert V;x;;;;x;;;;x;;;;;x;;;;;;;;;x
|
||||
13.12.2022;Gebratene Nudeln;mit Gemüse;Vegetarisch;;;;;;x;;;x;;x;;x;;;x;;;;;;;x
|
||||
13.12.2022;Berliner;mit Erdbeerfüllung;Dessert;;;x;;;x;;;;x;;;;;x;;;;;x;;;x
|
||||
14.12.2022;Bratkartoffeln;mit veganer Bratensoße;Vegan;;x;;;;x;;;;;;x;;;;;x;;;;;;x
|
||||
14.12.2022;Pudding;mit Schokostreuseln;Dessert V;x;;x;;;x;;;x;;;;;;;x;;;;;;;x
|
||||
14.12.2022;Bratkartoffeln;mit Leberkäse und Ei;Fleisch;;;;x;;x;;;x;;;;x;;;;;;;;;;x
|
||||
14.12.2022;Pudding;mit Vanillesoße;Dessert;;;x;;;x;;x;;;x;;;;;;x;;;;;;x
|
||||
15.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x
|
||||
15.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x
|
||||
15.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x
|
||||
15.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x
|
||||
16.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x
|
||||
16.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x
|
||||
16.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x
|
||||
16.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x
|
12
orders.txt
Normal file
12
orders.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;9999999;Fleisch;Dessert
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;9999999;Fleisch;Dessert
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;1234;Fleisch;Dessert
|
12
orders2.txt
Normal file
12
orders2.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;9999999;Fleisch;Dessert
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;9999999;Fleisch;Dessert
|
||||
12.12.2022;1234567;Vegan;Dessert V
|
||||
12.12.2022;7654321;Vegan;Dessert V
|
||||
12.12.2022;123;Vegetarisch;Dessert V
|
||||
12.12.2022;1234;Fleisch;Dessert
|
BIN
out/production/VPR_SCRIPT/Data.class
Normal file
BIN
out/production/VPR_SCRIPT/Data.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
out/production/VPR_SCRIPT/Order.class
Normal file
BIN
out/production/VPR_SCRIPT/Order.class
Normal file
Binary file not shown.
Binary file not shown.
384
src/Data.java
384
src/Data.java
@@ -1,9 +1,14 @@
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Data is a class to edit files.
|
||||
@@ -23,7 +28,6 @@ public class Data {
|
||||
*
|
||||
* @return Arraylist userList
|
||||
* @author Madeleine Vigier, Sabine Gubitz
|
||||
* @version 1.3
|
||||
*/
|
||||
public ArrayList<User> readUser() {
|
||||
List<String> rows = getRows();
|
||||
@@ -50,139 +54,122 @@ public class Data {
|
||||
*
|
||||
* @return Arraylist menuelist
|
||||
* @author Madeleine Vigier, Sabine Gubitz
|
||||
* @version 1.3
|
||||
*/
|
||||
public ArrayList<Menue> readMenue() {
|
||||
public ArrayList<Menu> readMenu() {
|
||||
|
||||
List<String> rows = getRows();
|
||||
ArrayList<Menue> menueList = new ArrayList<>();
|
||||
ArrayList<Menu> menuList = new ArrayList<>();
|
||||
|
||||
|
||||
for (String row : rows) {
|
||||
|
||||
String[] parts = row.split(";");
|
||||
|
||||
|
||||
String date = parts[0];
|
||||
String dish = parts[1];
|
||||
String sideDish = parts[2];
|
||||
String typ = parts[3];
|
||||
String allergens = parts[4];
|
||||
String ingredient = parts[4];
|
||||
|
||||
List<String> ingredients = new ArrayList<>();
|
||||
|
||||
boolean eggs = false;
|
||||
if (allergens != "") {
|
||||
eggs = true;
|
||||
|
||||
}
|
||||
allergens = parts[5];
|
||||
boolean peanuts = false;
|
||||
if (allergens != "") {
|
||||
peanuts = true;
|
||||
}
|
||||
allergens = parts[6];
|
||||
boolean fish = false;
|
||||
if (allergens != "") {
|
||||
fish = true;
|
||||
}
|
||||
allergens = parts[7];
|
||||
boolean grains = false;
|
||||
if (allergens != "") {
|
||||
grains = true;
|
||||
}
|
||||
allergens = parts[8];
|
||||
boolean crustaceans = false;
|
||||
if (allergens != "") {
|
||||
crustaceans = true;
|
||||
}
|
||||
allergens = parts[9];
|
||||
boolean lupines = false;
|
||||
if (allergens != "") {
|
||||
lupines = true;
|
||||
}
|
||||
allergens = parts[10];
|
||||
boolean milk = false;
|
||||
if (allergens != "") {
|
||||
milk = true;
|
||||
}
|
||||
allergens = parts[11];
|
||||
boolean nuts = false;
|
||||
if (allergens != "") {
|
||||
nuts = true;
|
||||
}
|
||||
allergens = parts[12];
|
||||
boolean sulfurDioxideAndSulfite = false;
|
||||
if (allergens != "") {
|
||||
sulfurDioxideAndSulfite = true;
|
||||
}
|
||||
allergens = parts[13];
|
||||
boolean celeriac = false;
|
||||
if (allergens != "") {
|
||||
celeriac = true;
|
||||
}
|
||||
allergens = parts[14];
|
||||
boolean mustards = false;
|
||||
if (allergens != "") {
|
||||
mustards = true;
|
||||
}
|
||||
allergens = parts[15];
|
||||
boolean sesame = false;
|
||||
if (allergens != "") {
|
||||
sesame = true;
|
||||
}
|
||||
allergens = parts[16];
|
||||
boolean soy = false;
|
||||
if (allergens != "") {
|
||||
soy = true;
|
||||
}
|
||||
allergens = parts[17];
|
||||
boolean molluscs = false;
|
||||
if (allergens != "") {
|
||||
molluscs = true;
|
||||
}
|
||||
String additives = parts[18];
|
||||
boolean antioxidant = false;
|
||||
if (additives != "") {
|
||||
antioxidant = true;
|
||||
}
|
||||
additives = parts[19];
|
||||
boolean artificialColours = false;
|
||||
if (additives != "") {
|
||||
artificialColours = true;
|
||||
}
|
||||
additives = parts[20];
|
||||
boolean flavourEnhancer = false;
|
||||
if (additives != "") {
|
||||
flavourEnhancer = true;
|
||||
}
|
||||
additives = parts[21];
|
||||
boolean preservatives = false;
|
||||
if (additives != "") {
|
||||
preservatives = true;
|
||||
}
|
||||
additives = parts[22];
|
||||
boolean nitrate = false;
|
||||
if (additives != "") {
|
||||
nitrate = true;
|
||||
}
|
||||
additives = parts[23];
|
||||
boolean picklingSalt = false;
|
||||
if (additives != "") {
|
||||
picklingSalt = true;
|
||||
}
|
||||
additives = parts[24];
|
||||
boolean phosphate = false;
|
||||
if (additives != "") {
|
||||
phosphate = true;
|
||||
}
|
||||
additives = parts[25];
|
||||
boolean artificialSweetener = false;
|
||||
if (additives != "") {
|
||||
artificialSweetener = true;
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("a"); //eggs
|
||||
}
|
||||
|
||||
menueList.add(new Menue(date, dish, sideDish, typ, eggs, peanuts, fish, grains,
|
||||
crustaceans, lupines, milk, nuts, sulfurDioxideAndSulfite, celeriac, mustards, sesame,
|
||||
soy, molluscs, antioxidant, artificialColours, flavourEnhancer, preservatives, nitrate,
|
||||
picklingSalt, artificialSweetener, phosphate));
|
||||
ingredient = parts[5];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("d"); //peanuts
|
||||
}
|
||||
return menueList;
|
||||
ingredient = parts[6];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("m"); //fish
|
||||
}
|
||||
ingredient = parts[7];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("g"); //grains
|
||||
}
|
||||
ingredient = parts[8];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("f"); //crustaceans
|
||||
}
|
||||
ingredient = parts[9];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("n"); //lupines
|
||||
}
|
||||
ingredient = parts[10];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("c"); //milk
|
||||
}
|
||||
ingredient = parts[11];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("k"); //nuts
|
||||
}
|
||||
ingredient = parts[12];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("j"); //sulfurDioxideAndSulfite
|
||||
}
|
||||
ingredient = parts[13];
|
||||
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("l"); //celeriac
|
||||
}
|
||||
ingredient = parts[14];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("h"); //mustards
|
||||
}
|
||||
ingredient = parts[15];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("i"); //sesame
|
||||
}
|
||||
ingredient = parts[16];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("b");//soy
|
||||
}
|
||||
ingredient = parts[17];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("e");//molluscs
|
||||
}
|
||||
ingredient = parts[18];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("4"); //antioxidant
|
||||
}
|
||||
ingredient = parts[19];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("5");
|
||||
}
|
||||
ingredient = parts[20];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("6"); //flavourEnhancer
|
||||
}
|
||||
ingredient = parts[21];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("8"); // preservatives
|
||||
}
|
||||
ingredient = parts[22];
|
||||
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("3"); //nitrate
|
||||
}
|
||||
ingredient = parts[23];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("1");//picklingSalt
|
||||
}
|
||||
ingredient = parts[24];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("7"); //artificialSweetener
|
||||
}
|
||||
ingredient = parts[25];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("2"); //phosphate
|
||||
|
||||
}
|
||||
String end = parts[26]; //endpoint
|
||||
|
||||
menuList.add(new Menu(date, dish, sideDish, typ, ingredients));
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,29 +178,20 @@ public class Data {
|
||||
*
|
||||
* @return Arraylist orderlist
|
||||
* @author Madeleine Vigier, Sabine Gubitz
|
||||
* @version 1.2
|
||||
*/
|
||||
public ArrayList<Order> readOrder() {
|
||||
|
||||
ArrayList<String> orderList = new ArrayList<>();
|
||||
ArrayList<Order> orderList = new ArrayList<>();
|
||||
List<String> rows = getRows();
|
||||
|
||||
for (String row : rows) {
|
||||
String[] parts = row.split(";");
|
||||
|
||||
String date = parts[0];
|
||||
String meat = parts[1];
|
||||
String meatCount = parts[2];
|
||||
String vegi = parts[3];
|
||||
String vegiCount = parts[4];
|
||||
String vegan = parts[5];
|
||||
String veganCount = parts[6];
|
||||
String desertV = parts[7];
|
||||
String desertVCount = parts[8];
|
||||
String desert = parts[9];
|
||||
String desertCount = parts[10];
|
||||
//orderList.add(new Order(date, meat, meatCount,vegi, vegiCount, vegan, veganCount, desertV,
|
||||
// desertVCount, desert, desertCount))
|
||||
String user = parts[1];
|
||||
String mealtype = parts[3];
|
||||
String deserttype = parts[5];
|
||||
orderList.add(new Order(date, user, mealtype, deserttype));
|
||||
}
|
||||
return null;//orderList
|
||||
|
||||
@@ -222,14 +200,30 @@ public class Data {
|
||||
/**
|
||||
* The method writeData writes the data of a List into a txt file.
|
||||
*
|
||||
* @author Felix Wöstemeyer
|
||||
*
|
||||
* @param pathWrite determines the filename of the file that will be written
|
||||
* @param listToWrite determines which ArrayList is to be used for writing the file
|
||||
*/
|
||||
public void writeData(String pathWrite, ArrayList<String> listToWrite) {
|
||||
if (pathWrite.equals("users.txt")) {
|
||||
|
||||
} else if (pathWrite.equals("orders.txt")) {
|
||||
|
||||
try {
|
||||
if (new File(pathWrite).exists()) {
|
||||
for (String zeile : listToWrite) {
|
||||
new FileWriter(pathWrite).write(zeile);
|
||||
}
|
||||
}else
|
||||
{
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Der Pfad oder die Datei "+ pathWrite +" existiert nicht!\nMöchten Sie unter dem Pfad "+ pathWrite+ " eine neue Datei erstellen? (Y/N)");
|
||||
if(scanner.nextLine().equals("Y")){
|
||||
new File(pathWrite).createNewFile();
|
||||
System.out.println("Die Datei "+ pathWrite+" wurde erfolgreich erstellt");
|
||||
}else if(!scanner.nextLine().equals("N") && !scanner.nextLine().equals("Y")){
|
||||
System.out.println("Es ist ein Fehler mit ihrer Antwort aufgetreten!");
|
||||
}
|
||||
}
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +232,6 @@ public class Data {
|
||||
*
|
||||
* @return ArrayList rows
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
private List<String> getRows() {
|
||||
Path path = Paths.get(pathRead);
|
||||
@@ -250,5 +243,120 @@ public class Data {
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method validates the user input
|
||||
*
|
||||
* @return boolean inputValid
|
||||
* @author Kevin Maier
|
||||
*/
|
||||
private boolean validateData(String password, String phoneNumber)
|
||||
{
|
||||
boolean inputValid = false;
|
||||
boolean phoneNumberMatchFound;
|
||||
boolean passwordMatchFound;
|
||||
boolean phoneNumberValid = false;
|
||||
boolean passwordValid = false;
|
||||
|
||||
Pattern phoneNumberPattern = Pattern.compile("[0-9]*");
|
||||
Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$");
|
||||
|
||||
Scanner reader = new Scanner(System.in);
|
||||
|
||||
while(password.isEmpty() || phoneNumber.isEmpty())
|
||||
{
|
||||
System.out.println("Login fehlgeschlagen. Eingabe ist leer, versuchen Sie es erneut.");
|
||||
System.out.println("");
|
||||
System.out.print("Telefonnummer: ");
|
||||
phoneNumber = reader.nextLine();
|
||||
System.out.print("Passwort: ");
|
||||
password = reader.nextLine();
|
||||
}
|
||||
|
||||
Matcher phoneNumberMatcher = phoneNumberPattern.matcher(phoneNumber);
|
||||
Matcher passwordMatcher = passwordPattern.matcher(password);
|
||||
|
||||
phoneNumberMatchFound = phoneNumberMatcher.find();
|
||||
passwordMatchFound = passwordMatcher.find();
|
||||
|
||||
while (!inputValid) {
|
||||
if (!phoneNumberMatchFound || phoneNumber.length() != 15) {
|
||||
System.out.println("Login fehlgeschlagen. Die eingegebene Handynummer ist nicht valide.");
|
||||
System.out.println("");
|
||||
System.out.print("Telefonnummer: ");
|
||||
phoneNumber = reader.nextLine();
|
||||
System.out.print("Passwort: ");
|
||||
password = reader.nextLine();
|
||||
} else {
|
||||
phoneNumberValid = true;
|
||||
}
|
||||
|
||||
if (!passwordMatchFound || password.length() < 6 || password.length() > 20) {
|
||||
System.out.println("Login fehlgeschlagen. Das eingegebene Passwort ist nicht valide.");
|
||||
System.out.println("");
|
||||
System.out.print("Telefonnummer: ");
|
||||
phoneNumber = reader.nextLine();
|
||||
System.out.print("Passwort: ");
|
||||
password = reader.nextLine();
|
||||
} else {
|
||||
passwordValid = true;
|
||||
}
|
||||
|
||||
if (phoneNumberValid && passwordValid) {
|
||||
inputValid = true;
|
||||
}
|
||||
}
|
||||
return inputValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method changes the orders.txt file by removing canceled orders
|
||||
*
|
||||
* @return ArrayList\<Order> changedOrderList
|
||||
* @author Felix Düsterhaus
|
||||
*/
|
||||
|
||||
public ArrayList<Order> changeOrder(String userLogin) {
|
||||
|
||||
/*
|
||||
File orderFile = new File("C:/Unterricht/VPR/orders.txt");
|
||||
if (orderFile.delete()) {
|
||||
System.out.println("Datei gelöscht: " + orderFile.getName());
|
||||
} else {
|
||||
System.out.println("Fehler, " + orderFile.getName() + " nicht gelöscht.");
|
||||
}
|
||||
*/
|
||||
|
||||
ArrayList<Order> changedOrderList = new ArrayList<>();
|
||||
List<String> rows = getRows();
|
||||
int changedEntries = 0;
|
||||
|
||||
for (String row : rows) {
|
||||
String[] parts = row.split(";");
|
||||
|
||||
String date = parts[0];
|
||||
String user = parts[1];
|
||||
String mealtyp = parts[2];
|
||||
String deserttyp = parts[3];
|
||||
if(!userLogin.equals(user)) {
|
||||
changedOrderList.add(new Order(date, user, mealtyp, deserttyp));
|
||||
} else {
|
||||
changedEntries++;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
FileWriter writer = new FileWriter("orders2.txt");
|
||||
for(Order str: changedOrderList) {
|
||||
writer.write(str + System.lineSeparator());
|
||||
}
|
||||
writer.close();
|
||||
System.out.println("Daten gelöscht");
|
||||
System.out.println(changedEntries + " Einträge entfernt.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return changedOrderList;
|
||||
}
|
||||
}
|
||||
|
||||
|
119
src/Execute.java
119
src/Execute.java
@@ -1,3 +1,5 @@
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
@@ -5,68 +7,69 @@ import java.util.Scanner;
|
||||
* The class Execute is the execution file for the whole program.
|
||||
*/
|
||||
public class Execute {
|
||||
public static void main(String[] args) {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
//EXECUTE MENU OVERVIEW
|
||||
Data data = new Data("menue.txt");
|
||||
ArrayList<Menu> menu = data.readMenu();
|
||||
|
||||
ArrayList<Menue> menue = data.readMenue();
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
if (i % 4 == 0) {
|
||||
System.out.println();
|
||||
System.out.println("--------------------------------------");
|
||||
System.out.println(GeneralMethods.getDayNumberNew(menu.get(i).getDate()));
|
||||
System.out.println(menu.get(i).getDate());
|
||||
System.out.println();
|
||||
}
|
||||
System.out.println(menu.get(i));
|
||||
}
|
||||
|
||||
for (Menue m : menue) {
|
||||
System.out.println(m);
|
||||
}
|
||||
}
|
||||
// Data datei = new Data("users.txt");
|
||||
// ArrayList<User> user = datei.readUser();
|
||||
//
|
||||
// for (User user1 : user) {
|
||||
// System.out.println(user1);
|
||||
// }
|
||||
// System.out.println();
|
||||
// System.out.println("\t\t\tANMELDUNG");
|
||||
// int i = 0;
|
||||
// Scanner leser = new Scanner(System.in);
|
||||
//
|
||||
// while (true) {
|
||||
//
|
||||
//
|
||||
// System.out.print("Name: ");
|
||||
// boolean error = false;
|
||||
// String name = leser.nextLine();
|
||||
// error = isError(error, name);
|
||||
// System.out.print("Passwort: ");
|
||||
// String password = leser.nextLine();
|
||||
// error = isError(error, password);
|
||||
//
|
||||
//
|
||||
// for (User user1 : user) {
|
||||
// if (!error) {
|
||||
// if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(name)) {
|
||||
// System.out.println();
|
||||
// System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!");
|
||||
//
|
||||
// i++;
|
||||
// break;
|
||||
//
|
||||
// } else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(name))) {
|
||||
// System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut.");
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// }else{
|
||||
// System.out.println("Bitte Anmeldedaten angeben.");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (i > 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
System.out.println("a: Eier; b: Soja, c: Milch; d: Erdnüsse; e: Weichtiere; f: Krebstiere; g: Getreide; h: Senf\n"
|
||||
+ "i: Sesam; j: Schwefeldioxid und Sulfit; k: Nüsse; l: Sellerie; m: Fische; n: Lupinen\n"
|
||||
+ "1: Nitrit-Pökelsalz; 2: Phosphat; 3: Nitrat; 4: Antioxidationsmittel; 5: Farbstoff;\n"
|
||||
+ "6: Geschmacksverstärker; 7: Süßungsmittel; 8: Konservierungsstoff");
|
||||
|
||||
private static boolean isError(boolean error, String name) {
|
||||
if (name.isEmpty()) {
|
||||
error = true;
|
||||
/**
|
||||
* In the Login-Area the user can type the phonenumber and the password to login.
|
||||
* In the Background, the class Login checks the input and return whether the login was correct or not.
|
||||
*
|
||||
* @author Kevin Pfannenstiel
|
||||
*/
|
||||
System.out.println("");
|
||||
System.out.println("____________________________LOGIN_______________________________");
|
||||
Data userData = new Data("user.txt");
|
||||
Login login = new Login();
|
||||
Scanner leser = new Scanner(System.in);
|
||||
System.out.println("");
|
||||
System.out.println("Bitte einloggen");
|
||||
System.out.print("Telefonnummer: ");
|
||||
String phoneNumber = leser.nextLine();
|
||||
System.out.print("Passwort: ");
|
||||
String password = leser.nextLine();
|
||||
|
||||
login.toLogin(userData.readUser(), password, phoneNumber);
|
||||
|
||||
/**
|
||||
* Test zum Daten löschen
|
||||
* @author Felix Düsterhaus
|
||||
*/
|
||||
Data orderData = new Data("orders2.txt");
|
||||
System.out.print("Möchten Sie Einträge löschen? (Y/N) ");
|
||||
String orderChangeDecision = leser.nextLine();
|
||||
if (orderChangeDecision.equals("Y") || orderChangeDecision.equals("y")) {
|
||||
ArrayList<Order> changedOrderList = orderData.changeOrder(phoneNumber);
|
||||
} else if (orderChangeDecision.equals("N") || orderChangeDecision.equals("n")) {
|
||||
System.out.println("Daten werden nicht geändert.");
|
||||
}
|
||||
while(!(orderChangeDecision.equals("Y") || orderChangeDecision.equals("y") || orderChangeDecision.equals("N") || orderChangeDecision.equals("n"))) {
|
||||
System.out.println("Bitte eine gültige Aussage treffen.\n");
|
||||
System.out.print("Möchten Sie Einträge löschen? (Y/N) ");
|
||||
orderChangeDecision = leser.nextLine();
|
||||
|
||||
if (orderChangeDecision.equals("Y") || orderChangeDecision.equals("y")) {
|
||||
ArrayList<Order> changedOrderList = orderData.changeOrder(phoneNumber);
|
||||
} else if (orderChangeDecision.equals("N") || orderChangeDecision.equals("n")) {
|
||||
System.out.println("Daten werden nicht geändert.");
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
@@ -1,123 +1,58 @@
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
/**GeneralMethods is a class for commen public methods.
|
||||
/**
|
||||
* GeneralMethods is a class for commen public methods.
|
||||
*
|
||||
* @auhtor Felix Wöstemeyer
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Felix Wöstemeyer
|
||||
* @version 1.4
|
||||
*/
|
||||
public class GeneralMethods {
|
||||
/**The method writeData saves the given data to a certain file.
|
||||
|
||||
/**
|
||||
* The method getDayNumberNew() gets the Number of day in week
|
||||
*
|
||||
* @param pathWrite the given filepath to write
|
||||
* @param data the data to be saved
|
||||
* @param dateString date as String e.g. 12.12.2022
|
||||
* @return the Number of day in week
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public static void writeData(String pathWrite, ArrayList<String> data){
|
||||
try{
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(pathWrite));
|
||||
for (String d : data) {
|
||||
writer.write(d);
|
||||
writer.newLine();
|
||||
}
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public static String getDayNumberNew(String dateString) {
|
||||
//https://stackoverflow.com/questions/8746084/string-to-localdate
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||
formatter = formatter.withLocale(Locale.GERMANY); // Locale specifies human language for translating, and cultural norms for lowercase/uppercase and abbreviations and such. Example: Locale.US or Locale.CANADA_FRENCH
|
||||
LocalDate date = LocalDate.parse(dateString, formatter);
|
||||
|
||||
DayOfWeek day = date.getDayOfWeek();
|
||||
return getDayName(day.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Sabine Gubitz
|
||||
*ddd
|
||||
* The method read Data interprets a file and returns an useable list for other methods.
|
||||
* Files to be read have to use : as a divider between attributes
|
||||
* The method getDayName() gets the weekday
|
||||
*
|
||||
* @param pathRead determines the filename of the file that will be read
|
||||
* @return menueList, userList, orderList depending on Data read
|
||||
* @param dayNumber dayNumber e.g. 1 for Monday
|
||||
* @return String weekday
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public static ArrayList<String> readData(String pathRead) {
|
||||
Path path = Paths.get(pathRead);
|
||||
|
||||
try {
|
||||
List<String> rows = Files.readAllLines(path);
|
||||
|
||||
if (pathRead.equals("menue.txt")) {
|
||||
ArrayList<String> menueList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
String[] parts = row.split(":");
|
||||
|
||||
String day = parts[0];
|
||||
String date = parts[1];
|
||||
String meat = parts[2];
|
||||
String vegi = parts[3];
|
||||
String vegan = parts[4];
|
||||
String desert1 = parts[5];
|
||||
String desert2 = parts[6];
|
||||
menueList.add(day + "," + date + "," + meat + "," + vegi + "," + vegan + "," + desert1 + "," + desert2);
|
||||
public static String getDayName(int dayNumber) {
|
||||
if (dayNumber == 1) {
|
||||
return "Montag";
|
||||
}
|
||||
return menueList;
|
||||
|
||||
} else if (pathRead.equals("users.txt")){
|
||||
ArrayList<String> userList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
String[] parts = row.split(":");
|
||||
|
||||
String nameParent1 = parts[0];
|
||||
String nameParent2 = parts[1];
|
||||
String billAddress = parts[2];
|
||||
String phonenumber = parts[3];
|
||||
String nameChildren = parts[4];
|
||||
String password = parts[5];
|
||||
if (dayNumber == 2) {
|
||||
return "Dienstag";
|
||||
}
|
||||
return userList;
|
||||
|
||||
} else if (pathRead.equals("orders.txt")) {
|
||||
ArrayList<String> orderList = new ArrayList<>();
|
||||
|
||||
for (String row : rows) {
|
||||
String[] parts = row.split(":");
|
||||
|
||||
String date = parts[0];
|
||||
String meat = parts[1];
|
||||
String meatCount = parts[2];
|
||||
String vegi = parts[3];
|
||||
String vegiCount = parts[4];
|
||||
String vegan = parts[5];
|
||||
String veganCount = parts[6];
|
||||
String desert1 = parts[7];
|
||||
String desert1Count = parts[8];
|
||||
String desert2 = parts[9];
|
||||
String desert2Count = parts[10];
|
||||
if (dayNumber == 3) {
|
||||
return "Mittwoch";
|
||||
}
|
||||
if (dayNumber == 4) {
|
||||
return "Donnerstag";
|
||||
}
|
||||
if (dayNumber == 5) {
|
||||
return "Freitag";
|
||||
}
|
||||
return orderList;
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The method writeData2 writes the data of a List into a txt file.
|
||||
* @param pathWrite determines the filename of the file that will be written
|
||||
* @param listToWrite determines which ArrayList is to be used for writing the file
|
||||
*/
|
||||
public void writeData2 (String pathWrite, ArrayList<String> listToWrite){
|
||||
if (pathWrite.equals("users.txt")) {
|
||||
|
||||
} else if (pathWrite.equals("orders.txt")) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
69
src/Login.java
Normal file
69
src/Login.java
Normal file
@@ -0,0 +1,69 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Login {
|
||||
/**
|
||||
* The method toLogin() compares the phonenumber and password of the user with the phonenumber and password
|
||||
* from the user.txt
|
||||
*
|
||||
* @param user all users are in a list
|
||||
* @param password password of the user
|
||||
* @param phoneNumber phonenumber of the user
|
||||
* @return void
|
||||
* @author Kevin Pfannenstiel
|
||||
*/
|
||||
public void toLogin(ArrayList<User> user, String password, String phoneNumber) {
|
||||
|
||||
Scanner leser = new Scanner(System.in);
|
||||
|
||||
System.out.println();
|
||||
int i = 0;
|
||||
|
||||
while (true) {
|
||||
|
||||
boolean error = false;
|
||||
error = isError(error, phoneNumber);
|
||||
|
||||
for (User user1 : user) {
|
||||
if (!error) {
|
||||
if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber)) {
|
||||
System.out.println("");
|
||||
System.out.println("\t\t\tANMELDUNG");
|
||||
System.out.println();
|
||||
System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!");
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber))) {
|
||||
System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut.");
|
||||
System.out.println("");
|
||||
System.out.print("Telefonnummer: ");
|
||||
phoneNumber = leser.nextLine();
|
||||
System.out.print("Passwort: ");
|
||||
password = leser.nextLine();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The method getDayNumberNew() checks if the phonenumber-input is empty.
|
||||
*
|
||||
* @param error is a boolean
|
||||
* @param phoneNumber is the input of the user
|
||||
* @return the boolean error
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public boolean isError(boolean error, String phoneNumber) {
|
||||
if (phoneNumber.isEmpty()) {
|
||||
error = true;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
71
src/Menu.java
Normal file
71
src/Menu.java
Normal file
@@ -0,0 +1,71 @@
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Menu is a class to built a menu
|
||||
*
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.1
|
||||
*/
|
||||
public class Menu {
|
||||
String date;
|
||||
String dish;
|
||||
String sideDish;
|
||||
String type;
|
||||
List<String> ingredients;
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param date date of meal
|
||||
* @param dish meal
|
||||
* @param sideDish side dish
|
||||
* @param type vegan, vegetarian or meat
|
||||
* @param ingredients list of ingredients
|
||||
*/
|
||||
public Menu(String date, String dish, String sideDish, String type, List<String> ingredients) {
|
||||
this.date = date;
|
||||
this.dish = dish;
|
||||
this.sideDish = sideDish;
|
||||
this.type = type;
|
||||
this.ingredients = ingredients;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method get Date() gets the date
|
||||
*
|
||||
* @return date
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method getTyp() gets the typ of the meal
|
||||
*
|
||||
* @return typ e.g. Vegan
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public String getType() {
|
||||
if (type.contains("DessertV") || type.contains("Dessert")) {
|
||||
return "";
|
||||
} else {
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The method toString() returns a String formated to save in a File
|
||||
*
|
||||
* @return a String with dish, sideDish, list of ingredients and the typ of the menu
|
||||
* @author Madeleine Vigier, Felix Wöstemeyer
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return date+";"+dish+";"+sideDish+";"+type+";"+ingredients;
|
||||
}
|
||||
}
|
||||
|
227
src/Menue.java
227
src/Menue.java
@@ -1,227 +0,0 @@
|
||||
/**
|
||||
* Menue is a class to built a menue
|
||||
*
|
||||
* @author: Madeleine Vigier
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class Menue {
|
||||
String date;
|
||||
String dish;
|
||||
String sideDish;
|
||||
String typ;
|
||||
boolean eggs;
|
||||
boolean peanuts;
|
||||
boolean fish;
|
||||
boolean grains;
|
||||
boolean crustaceans;
|
||||
boolean lupines;
|
||||
boolean milk;
|
||||
boolean nuts;
|
||||
boolean sulfurDioxideAndSulfite;
|
||||
boolean celeriac;
|
||||
boolean mustards;
|
||||
boolean sesame;
|
||||
boolean soy;
|
||||
boolean molluscs;
|
||||
boolean antioxidant;
|
||||
boolean artificialColours;
|
||||
boolean flavourEnhancer;
|
||||
boolean preservatives;
|
||||
boolean nitrate;
|
||||
boolean picklingSalt;
|
||||
boolean phosphate;
|
||||
boolean artificialSweetener;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param date date of meal
|
||||
* @param dish meal
|
||||
* @param sideDish side dish
|
||||
* @param typ vegan, vegetarian or meat
|
||||
* @param eggs allergens
|
||||
* @param peanuts allergens
|
||||
* @param fish allergens
|
||||
* @param grains allergens
|
||||
* @param crustaceans allergens
|
||||
* @param lupines allergens
|
||||
* @param milk allergens
|
||||
* @param nuts allergens
|
||||
* @param sulfurDioxideAndSulfite additives
|
||||
* @param celeriac additives
|
||||
* @param mustards additives
|
||||
* @param sesame additives
|
||||
* @param soy additives
|
||||
* @param molluscs additives
|
||||
* @param antioxidant additives
|
||||
* @param artificialColours additives
|
||||
* @param flavourEnhancer additives
|
||||
* @param preservatives additives
|
||||
* @param nitrate additives
|
||||
* @param picklingSalt additives
|
||||
* @param phosphate additives
|
||||
* @param artificialSweetener additives
|
||||
*/
|
||||
public Menue(String date, String dish, String sideDish, String typ, boolean eggs, boolean peanuts, boolean fish, boolean grains, boolean crustaceans, boolean lupines, boolean milk, boolean nuts, boolean sulfurDioxideAndSulfite, boolean celeriac, boolean mustards, boolean sesame, boolean soy, boolean molluscs, boolean antioxidant, boolean artificialColours, boolean flavourEnhancer, boolean preservatives, boolean nitrate, boolean picklingSalt, boolean phosphate, boolean artificialSweetener) {
|
||||
this.date = date;
|
||||
this.dish = dish;
|
||||
this.sideDish = sideDish;
|
||||
this.typ = typ;
|
||||
this.eggs = eggs;
|
||||
this.peanuts = peanuts;
|
||||
this.fish = fish;
|
||||
this.grains = grains;
|
||||
this.crustaceans = crustaceans;
|
||||
this.lupines = lupines;
|
||||
this.milk = milk;
|
||||
this.nuts = nuts;
|
||||
this.sulfurDioxideAndSulfite = sulfurDioxideAndSulfite;
|
||||
this.celeriac = celeriac;
|
||||
this.mustards = mustards;
|
||||
this.sesame = sesame;
|
||||
this.soy = soy;
|
||||
this.molluscs = molluscs;
|
||||
this.antioxidant = antioxidant;
|
||||
this.artificialColours = artificialColours;
|
||||
this.flavourEnhancer = flavourEnhancer;
|
||||
this.preservatives = preservatives;
|
||||
this.nitrate = nitrate;
|
||||
this.picklingSalt = picklingSalt;
|
||||
this.phosphate = phosphate;
|
||||
this.artificialSweetener = artificialSweetener;
|
||||
}
|
||||
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public String getDish() {
|
||||
return dish;
|
||||
}
|
||||
|
||||
public String getSideDish() {
|
||||
return sideDish;
|
||||
}
|
||||
|
||||
public String getTyp() {
|
||||
if (typ.equals("DessertV") || typ.equals("Dessert")) {
|
||||
return "";
|
||||
} else {
|
||||
|
||||
return typ;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEggs() {
|
||||
if (eggs) {
|
||||
return "a";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getPeanuts() {
|
||||
if (peanuts) {
|
||||
return "d";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getFish() {
|
||||
if (fish) {
|
||||
return "m";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getGrains() {
|
||||
if (grains) {
|
||||
return "a";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCrustaceans() {
|
||||
return crustaceans;
|
||||
}
|
||||
|
||||
public boolean isLupines() {
|
||||
return lupines;
|
||||
}
|
||||
|
||||
public boolean isMilk() {
|
||||
return milk;
|
||||
}
|
||||
|
||||
public boolean isNuts() {
|
||||
return nuts;
|
||||
}
|
||||
|
||||
public boolean isSulfurDioxideAndSulfite() {
|
||||
return sulfurDioxideAndSulfite;
|
||||
}
|
||||
|
||||
public boolean isCeleriac() {
|
||||
return celeriac;
|
||||
}
|
||||
|
||||
public boolean isMustards() {
|
||||
return mustards;
|
||||
}
|
||||
|
||||
public boolean isSesame() {
|
||||
return sesame;
|
||||
}
|
||||
|
||||
public boolean isSoy() {
|
||||
return soy;
|
||||
}
|
||||
|
||||
public boolean isMolluscs() {
|
||||
return molluscs;
|
||||
}
|
||||
|
||||
public boolean isAntioxidant() {
|
||||
return antioxidant;
|
||||
}
|
||||
|
||||
public boolean isArtificialColours() {
|
||||
return artificialColours;
|
||||
}
|
||||
|
||||
public boolean isFlavourEnhancer() {
|
||||
return flavourEnhancer;
|
||||
}
|
||||
|
||||
public boolean isPreservatives() {
|
||||
return preservatives;
|
||||
}
|
||||
|
||||
public boolean isNitrate() {
|
||||
return nitrate;
|
||||
}
|
||||
|
||||
public boolean isPicklingSalt() {
|
||||
return picklingSalt;
|
||||
}
|
||||
|
||||
public boolean isPhosphate() {
|
||||
return phosphate;
|
||||
}
|
||||
|
||||
public boolean isArtificialSweetener() {
|
||||
return artificialSweetener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Montag\n" + "\t\t\t\t" + dish + "\n" + sideDish
|
||||
+ "Allergene" + "\n" + getTyp();
|
||||
}
|
||||
}
|
||||
|
@@ -1,2 +1,47 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* The class Order is an object class that holds the constructor for order objects.
|
||||
*
|
||||
* @author Sabine Gubitz
|
||||
* @version 1.2
|
||||
*/
|
||||
|
||||
public class Order {
|
||||
String date; //date for the meal, not the day it was ordered
|
||||
String user; //phone number of the user account
|
||||
String mealtype; //meat, vegi or vegan
|
||||
String desserttype; //desert or vegan desert
|
||||
|
||||
Order (String date, String user, String mealtype, String desserttype)
|
||||
{
|
||||
this.date = date;
|
||||
this.user = user;
|
||||
this.mealtype = mealtype;
|
||||
this.desserttype = desserttype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return date+";"+user+";"+mealtype+";"+desserttype;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Method create PDF is used to create a PDF document of the daily orders as well as the bills for each user
|
||||
*
|
||||
* This Method uses PDF Clown, the source code can be found at http://www.pdfclown.org
|
||||
* PDF Clown is covered by LGPL, a copy of the LGPL can be found withing the documentation
|
||||
*
|
||||
* @param pathWrite determines which document should be created
|
||||
* @param listToWrite determines the list which is to be used to create the document
|
||||
* @author Sabine Gubitz
|
||||
*/
|
||||
|
||||
public void createPDF (String pathWrite, ArrayList<String> listToWrite) {
|
||||
if (pathWrite.equals("users.pdf")) {
|
||||
|
||||
} else if (pathWrite.equals("bills.pdf")) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,91 +1,85 @@
|
||||
/**
|
||||
* User class creates User Objects
|
||||
*
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.1
|
||||
* @version 1.2
|
||||
*/
|
||||
public class User {
|
||||
private String nameParent1;
|
||||
private String nameParent2;
|
||||
private String billAddress;
|
||||
private String phonenumber;
|
||||
private String phoneNumber;
|
||||
private String nameChildren;
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param nameParent1
|
||||
* @param nameParent2
|
||||
* @param billAddress
|
||||
* @param phonenumber
|
||||
* @param nameChildren
|
||||
* @param password
|
||||
*
|
||||
* @param nameParent1 name of the first parent of the child
|
||||
* @param nameParent2 name of the second parent of the child
|
||||
* @param billAddress the address the bill should be sent to
|
||||
* @param phoneNumber phonenumber of one of the parents and also the username
|
||||
* @param nameChildren name of the children
|
||||
* @param password password of the user
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
public User(String nameParent1, String nameParent2, String billAddress, String phonenumber, String nameChildren, String password) {
|
||||
public User(String nameParent1, String nameParent2, String billAddress, String phoneNumber, String nameChildren, String password) {
|
||||
this.nameParent1 = nameParent1;
|
||||
this.nameParent2 = nameParent2;
|
||||
this.billAddress = billAddress;
|
||||
this.phonenumber = phonenumber;
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.nameChildren = nameChildren;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode getPhonenumber() gets the Phonenumber
|
||||
* the method getPhonenumber() gets the Phonenumber
|
||||
*
|
||||
* @return Phonenumber
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode getPassword() gets the password
|
||||
* the method getPassword() gets the password
|
||||
*
|
||||
* @return password
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode getNameParent1() gets nameParent1
|
||||
* the method getNameParent1() gets nameParent1
|
||||
*
|
||||
* @return nameParent1
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
public String getNameParent1() {
|
||||
return nameParent1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode getNameParent2() gets nameParent2
|
||||
* the method getNameParent2() gets nameParent2
|
||||
*
|
||||
* @return nameParent2
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
public String getNameParent2() {
|
||||
return nameParent2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode toString() returns a String representation of an object
|
||||
* the methode toString() returns a String representation of an object
|
||||
*
|
||||
* @return a String with nameParent1, nameparent2, billAdress, phonenumber, nameChildren, password
|
||||
* @author Madeleine Vigier
|
||||
* @version 1.0
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"nameParent1='" + nameParent1 + '\'' +
|
||||
", nameParent2='" + nameParent2 + '\'' +
|
||||
", billAddress='" + billAddress + '\'' +
|
||||
", phonenumber='" + phonenumber + '\'' +
|
||||
", nameChildren='" + nameChildren + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
'}';
|
||||
return nameParent1 + ";" + nameParent2 + ";" + billAddress + ";" + phoneNumber + ";" + nameChildren + ";" + password;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user