Compare commits
84 Commits
73fe014806
...
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 | |||
1bc6ecd05e | |||
97686d48ca | |||
c9206ed2da | |||
ce62929779 | |||
4a146547e7 | |||
dca8114442 | |||
7d042af6d2 | |||
e166254bff | |||
a8e080d232 | |||
59c99f0a62 | |||
6e583b939f | |||
81f1cac657 | |||
7914c07924 | |||
87b8a566f1 | |||
48d3f5b08b | |||
af41dc7cf8 | |||
c5c096dfa7 | |||
b8f0ebb121 | |||
4f3522cf0e | |||
012b463b21 | |||
6b6aecffda | |||
715a6fa94a | |||
f2202682b6 | |||
ed4aeefae8 | |||
6ecaddc39d | |||
72f3ed5ba6 | |||
27f72a7766 | |||
b206ba0c91 | |||
8d4851eecc | |||
07e3e6ffad | |||
e535eefa93 | |||
c5a180e752 | |||
05e6b727d5 |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
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>
|
20
menue.txt
Normal file
20
menue.txt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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.
BIN
out/production/VPR_SCRIPT/User.class
Normal file
BIN
out/production/VPR_SCRIPT/User.class
Normal file
Binary file not shown.
362
src/Data.java
Normal file
362
src/Data.java
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
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.
|
||||||
|
*
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
* @version 1.3
|
||||||
|
*/
|
||||||
|
public class Data {
|
||||||
|
private String pathRead;
|
||||||
|
|
||||||
|
public Data(String pathRead) {
|
||||||
|
this.pathRead = pathRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* readUser() is a method to split user.txt into lines and save them in an arraylist
|
||||||
|
*
|
||||||
|
* @return Arraylist userList
|
||||||
|
* @author Madeleine Vigier, Sabine Gubitz
|
||||||
|
*/
|
||||||
|
public ArrayList<User> readUser() {
|
||||||
|
List<String> rows = getRows();
|
||||||
|
ArrayList<User> 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];
|
||||||
|
userList.add(new User(nameParent1, nameParent2, billAddress, phonenumber, nameChildren, password));
|
||||||
|
}
|
||||||
|
return userList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* readMenue() is a method to split menue.txt into lines and save them in an arraylist
|
||||||
|
*
|
||||||
|
* @return Arraylist menuelist
|
||||||
|
* @author Madeleine Vigier, Sabine Gubitz
|
||||||
|
*/
|
||||||
|
public ArrayList<Menu> readMenu() {
|
||||||
|
|
||||||
|
List<String> rows = getRows();
|
||||||
|
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 ingredient = parts[4];
|
||||||
|
|
||||||
|
List<String> ingredients = new ArrayList<>();
|
||||||
|
|
||||||
|
if (!ingredient.isEmpty()) {
|
||||||
|
ingredients.add("a"); //eggs
|
||||||
|
}
|
||||||
|
|
||||||
|
ingredient = parts[5];
|
||||||
|
if (!ingredient.isEmpty()) {
|
||||||
|
ingredients.add("d"); //peanuts
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* readOrder() is a method to split order.txt into lines and save them in an arraylist
|
||||||
|
*
|
||||||
|
* @return Arraylist orderlist
|
||||||
|
* @author Madeleine Vigier, Sabine Gubitz
|
||||||
|
*/
|
||||||
|
public ArrayList<Order> readOrder() {
|
||||||
|
|
||||||
|
ArrayList<Order> orderList = new ArrayList<>();
|
||||||
|
List<String> rows = getRows();
|
||||||
|
|
||||||
|
for (String row : rows) {
|
||||||
|
String[] parts = row.split(";");
|
||||||
|
|
||||||
|
String date = parts[0];
|
||||||
|
String user = parts[1];
|
||||||
|
String mealtype = parts[3];
|
||||||
|
String deserttype = parts[5];
|
||||||
|
orderList.add(new Order(date, user, mealtype, deserttype));
|
||||||
|
}
|
||||||
|
return null;//orderList
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The method gets the rows by reading all lines of the path
|
||||||
|
*
|
||||||
|
* @return ArrayList rows
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
private List<String> getRows() {
|
||||||
|
Path path = Paths.get(pathRead);
|
||||||
|
List<String> rows = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
rows = Files.readAllLines(path);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -1,13 +1,75 @@
|
|||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**The class Execute is the executen file for the whole programm.
|
/**
|
||||||
|
* The class Execute is the execution file for the whole program.
|
||||||
*/
|
*/
|
||||||
public class Execute {
|
public class Execute {
|
||||||
public static void main (String[]args){
|
public static void main(String[] args) throws IOException {
|
||||||
ArrayList<String> data = GeneralMethods.readData("test.csv");
|
//EXECUTE MENU OVERVIEW
|
||||||
for(String d : data){
|
Data data = new Data("menue.txt");
|
||||||
System.out.println(d);
|
ArrayList<Menu> menu = data.readMenu();
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GeneralMethods.writeData("test2.csv",data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
public class FDtest {
|
|
||||||
}
|
|
@@ -1,142 +1,58 @@
|
|||||||
import java.io.BufferedWriter;
|
import java.time.DayOfWeek;
|
||||||
import java.io.FileWriter;
|
import java.time.LocalDate;
|
||||||
import java.io.IOException;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.nio.file.Files;
|
import java.util.Locale;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**GeneralMethods is a class for commen public methods.
|
/**
|
||||||
|
* GeneralMethods is a class for commen public methods.
|
||||||
*
|
*
|
||||||
* @auhtor Felix Wöstemeyer
|
* @author Felix Wöstemeyer
|
||||||
*
|
* @version 1.4
|
||||||
* @version 1.0
|
|
||||||
*/
|
*/
|
||||||
public class GeneralMethods {
|
public class GeneralMethods {
|
||||||
|
|
||||||
/**The method readData gives back an ArrayList from the data of a given file.
|
/**
|
||||||
|
* The method getDayNumberNew() gets the Number of day in week
|
||||||
*
|
*
|
||||||
* @param pathRead the given filepath to read
|
* @param dateString date as String e.g. 12.12.2022
|
||||||
* @return returns an ArrayList of Strings with the read data
|
* @return the Number of day in week
|
||||||
|
* @author Madeleine Vigier
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> readData(String pathRead){
|
public static String getDayNumberNew(String dateString) {
|
||||||
try {
|
//https://stackoverflow.com/questions/8746084/string-to-localdate
|
||||||
ArrayList<String> data = new ArrayList<String>();
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||||
List<String> lines = Files.readAllLines(Paths.get(pathRead));
|
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
|
||||||
for(String line : lines){
|
LocalDate date = LocalDate.parse(dateString, formatter);
|
||||||
data.add(line);
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return new ArrayList<String>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**The method writeData saves the given data to a certain file.
|
DayOfWeek day = date.getDayOfWeek();
|
||||||
*
|
return getDayName(day.getValue());
|
||||||
* @param pathWrite the given filepath to write
|
|
||||||
* @param data the data to be saved
|
|
||||||
*/
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Folgender Code von Sabine, zum gegen prüfen und entscheiden
|
* The method getDayName() gets the weekday
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
* @param pathRead determines the filename of the file that will be read
|
* @param dayNumber dayNumber e.g. 1 for Monday
|
||||||
* @return menueList, userList, orderList depending on Data read
|
* @return String weekday
|
||||||
|
* @author Madeleine Vigier
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> readData2(String pathRead) {
|
public static String getDayName(int dayNumber) {
|
||||||
Path path = Paths.get(pathRead);
|
if (dayNumber == 1) {
|
||||||
|
return "Montag";
|
||||||
try {
|
|
||||||
List<String> rows = Files.readAllLines(path);
|
|
||||||
|
|
||||||
if (pathRead == "menue.csv") {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
return menueList;
|
|
||||||
|
|
||||||
} else if (pathRead == "users.csv") {
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
return userList;
|
|
||||||
|
|
||||||
} else if (pathRead == "orders.csv") {
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
return orderList;
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
if (dayNumber == 2) {
|
||||||
|
return "Dienstag";
|
||||||
|
}
|
||||||
|
if (dayNumber == 3) {
|
||||||
|
return "Mittwoch";
|
||||||
|
}
|
||||||
|
if (dayNumber == 4) {
|
||||||
|
return "Donnerstag";
|
||||||
|
}
|
||||||
|
if (dayNumber == 5) {
|
||||||
|
return "Freitag";
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The method writeData 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 == "users.txt") {
|
|
||||||
|
|
||||||
} else if (pathWrite == "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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
47
src/Order.java
Normal file
47
src/Order.java
Normal file
@@ -0,0 +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,7 +0,0 @@
|
|||||||
public class TestKlasse {
|
|
||||||
|
|
||||||
public String Satz()
|
|
||||||
{
|
|
||||||
return "Satz";
|
|
||||||
}
|
|
||||||
}
|
|
85
src/User.java
Normal file
85
src/User.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* User class creates User Objects
|
||||||
|
*
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
* @version 1.2
|
||||||
|
*/
|
||||||
|
public class User {
|
||||||
|
private String nameParent1;
|
||||||
|
private String nameParent2;
|
||||||
|
private String billAddress;
|
||||||
|
private String phoneNumber;
|
||||||
|
private String nameChildren;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor
|
||||||
|
*
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
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.nameChildren = nameChildren;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the method getPhonenumber() gets the Phonenumber
|
||||||
|
*
|
||||||
|
* @return Phonenumber
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
public String getPhonenumber() {
|
||||||
|
return phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the method getPassword() gets the password
|
||||||
|
*
|
||||||
|
* @return password
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the method getNameParent1() gets nameParent1
|
||||||
|
*
|
||||||
|
* @return nameParent1
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
public String getNameParent1() {
|
||||||
|
return nameParent1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the method getNameParent2() gets nameParent2
|
||||||
|
*
|
||||||
|
* @return nameParent2
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
public String getNameParent2() {
|
||||||
|
return nameParent2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the methode toString() returns a String representation of an object
|
||||||
|
*
|
||||||
|
* @return a String with nameParent1, nameparent2, billAdress, phonenumber, nameChildren, password
|
||||||
|
* @author Madeleine Vigier
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return nameParent1 + ";" + nameParent2 + ";" + billAddress + ";" + phoneNumber + ";" + nameChildren + ";" + password;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user