Compare commits

...

84 Commits

Author SHA1 Message Date
51e370ad33 Quelle angepasst 2023-02-01 15:19:34 +01:00
f1fabad17d Java Doc 2023-02-01 15:19:12 +01:00
deeabfd2ad Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/Order.java
2023-02-01 12:42:34 +01:00
6ffc7a6868 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	out/production/VPR_SCRIPT/Data.class
#	out/production/VPR_SCRIPT/Execute.class
2023-02-01 12:42:23 +01:00
7e507fa95c General Methods gesäubert, Sicherungs Commit zur implementierung von PDF CLown 2023-01-23 08:50:32 +01:00
f35554f858 changeOrder methode ergänzt + test order files 2023-01-17 17:03:44 +01:00
9663777e25 Korrektur der writeData. 2023-01-17 16:43:28 +01:00
eeba57165b Merge remote-tracking branch 'origin/master' 2023-01-17 16:38:16 +01:00
58ec030102 Korrektur der Syntax und einhaltliche toString für das Speichern der Daten. 2023-01-17 16:37:39 +01:00
4baa3ef51b Merge remote-tracking branch 'origin/master' 2023-01-17 16:16:13 +01:00
a44c87cf83 isEmpty Abfrage entfernt und in validData Methode hinzugefügt 2023-01-17 16:15:58 +01:00
230202aa0a Merge remote-tracking branch 'origin/master' 2023-01-17 16:10:07 +01:00
3df13417c7 Korrektur der Syntax und einhaltliche toString für das Speichern der Daten. 2023-01-17 16:09:55 +01:00
d4a351a4e2 Merge remote-tracking branch 'origin/master' 2023-01-17 16:02:39 +01:00
83af3a6066 Regex in validateData geändert 2023-01-17 16:02:29 +01:00
d2f9ef49c9 Korrektur der Syntax und einhaltliche toString für das Speichern der Daten. 2023-01-17 15:43:56 +01:00
d858ff8f8d Methode validateData ergänzt 2023-01-16 16:53:30 +01:00
95069e7d8d to String Oder Class in Kommantar 2023-01-16 16:05:15 +01:00
3c51ebbc21 Order Klasse korrigiert & kommentiert 2023-01-12 12:20:24 +01:00
644df46a7a Order Klasse angepasst, sowie readOrder angepasst 2023-01-10 16:23:10 +01:00
19d36d3464 Order Klasse gefüllt, sowie readOrder Datentypen angepasst 2023-01-10 15:59:16 +01:00
12a8806fb6 Login ist jetzt auf english und kommentare wurden ergänzt. 2022-12-21 17:01:06 +01:00
de77901f5a Login aktualisiert! 2022-12-21 08:28:06 +01:00
76d08d93da Login ist so gut wie fertig! 2022-12-20 19:41:12 +01:00
2d683b9cc6 Login ergänzt 2022-12-20 19:12:54 +01:00
739e973cf7 Merge remote-tracking branch 'origin/master' 2022-12-20 19:10:13 +01:00
044f64635b Korrektur der Syntax und Überabeitung der Kommentare 2022-12-19 15:28:14 +01:00
487bdd8fe0 Merge remote-tracking branch 'origin/master' 2022-12-19 10:07:47 +01:00
c526229de9 users.txt wurde richtig im dateipfad positioniert 2022-12-19 10:07:05 +01:00
93bf389472 txt angepasst 2022-12-18 11:48:51 +01:00
1b73582469 kommentare angepasst 2022-12-18 08:47:47 +01:00
ad6c4dec56 kommentare angepasst 2022-12-18 08:45:25 +01:00
0b119f6637 quelle ergänzt 2022-12-18 07:53:31 +01:00
16ab1705f0 code bereinigt 2022-12-18 07:49:33 +01:00
6d690410ec Kommentare angepasst 2022-12-18 07:49:06 +01:00
922345077b code bereinigt 2022-12-18 07:48:42 +01:00
455e92a986 bla 2022-12-17 17:30:43 +01:00
7d2b03d584 toString() angepasst 2022-12-17 17:30:04 +01:00
27b2186c87 Tagname aus Datum erzeugt 2022-12-17 17:29:42 +01:00
bf8cf182db ausgabe angepasst 2022-12-17 17:28:35 +01:00
536d7fe1fb 15.12/16.12 ergänzt 2022-12-17 17:28:18 +01:00
4b51db302e Legenede ingredients hinzugefügt 2022-12-17 13:33:23 +01:00
5f0191d6cd Klasse ingredients gekürzt in List 2022-12-17 13:32:41 +01:00
61ba486e4f txt angepasst 2022-12-17 13:31:35 +01:00
eb249cb685 readMenue() List<>ingredients hinzugefügt 2022-12-17 13:31:21 +01:00
6f1b665c4c getTyp() angepasst 2022-12-16 09:13:18 +01:00
97a83dcc46 Kommentare angepasst 2022-12-16 08:55:06 +01:00
3a2e57d039 toString() angepasst 2022-12-16 08:40:05 +01:00
84ded9963a toString() angepasst 2022-12-16 08:37:51 +01:00
3d283c95cd menue.txt (in Bearbeitung) 2022-12-16 08:37:27 +01:00
a38bd2b59f menue methode angepasst 2022-12-15 20:03:06 +01:00
1bc6ecd05e menue methode angepasst 2022-12-15 19:38:36 +01:00
97686d48ca menue methode angepasst 2022-12-15 19:38:24 +01:00
c9206ed2da ausgabe 2022-12-15 19:37:48 +01:00
ce62929779 methoden angepasst 2022-12-15 19:37:26 +01:00
4a146547e7 menue.txt angepasst 2022-12-15 19:36:55 +01:00
dca8114442 menue.txt angepasst 2022-12-15 19:18:07 +01:00
7d042af6d2 menue.txt erstellt 2022-12-15 18:49:08 +01:00
e166254bff Klasse Menue erstellt (in bearbertung) 2022-12-14 20:53:16 +01:00
a8e080d232 Methoden angelegt/angepasst 2022-12-14 20:50:57 +01:00
59c99f0a62 Methoden angelegt/angepasst 2022-12-14 20:44:49 +01:00
6e583b939f Methoden angelegt/angepasst 2022-12-14 20:38:33 +01:00
81f1cac657 Klasse Order angelegt 2022-12-14 20:34:53 +01:00
7914c07924 user.txt angepasst 2022-12-14 20:34:17 +01:00
87b8a566f1 Code abgenommen 2022-12-14 13:17:46 +01:00
48d3f5b08b Comment Update 2022-12-13 11:54:23 +01:00
af41dc7cf8 writeData2 umbenannt in writeData() 2022-12-08 14:59:15 +01:00
c5c096dfa7 writeData2 umbenannt in writeData() 2022-12-07 12:14:54 +01:00
b8f0ebb121 code bereinigt, Methoden angepasst, java doc hinzugefügt 2022-12-07 12:02:02 +01:00
4f3522cf0e dateipfad bearbeitet 2022-11-30 15:15:01 +01:00
012b463b21 user.txt wieder hinzugefügt 2022-11-30 13:46:09 +01:00
6b6aecffda login 2022-11-29 16:20:48 +01:00
715a6fa94a testoj 2022-11-29 16:18:32 +01:00
f2202682b6 Merge remote-tracking branch 'origin/master' 2022-11-28 14:17:45 +01:00
ed4aeefae8 test 2022-11-28 14:17:38 +01:00
6ecaddc39d users.txt wurde richtig im dateipfad positioniert 2022-11-28 11:08:47 +01:00
72f3ed5ba6 static wurde der methode readdata ergänzt 2022-11-28 10:43:34 +01:00
27f72a7766 nummer ergänzt 2022-11-28 10:30:59 +01:00
b206ba0c91 ReadData festgelegt 2022-11-24 14:50:28 +01:00
8d4851eecc Dateien hochladen nach „src“ 2022-11-24 14:49:14 +01:00
07e3e6ffad „src/FDtest.java“ löschen 2022-11-24 14:48:53 +01:00
e535eefa93 test 2022-11-24 14:26:36 +01:00
c5a180e752 Merge remote-tracking branch 'origin/master' 2022-11-24 14:26:00 +01:00
05e6b727d5 test 2022-11-24 14:24:20 +01:00
21 changed files with 913 additions and 150 deletions

2
.idea/misc.xml generated
View File

@@ -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>

View File

@@ -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
View 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
View 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
View 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
View 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

Binary file not shown.

Binary file not shown.

Binary file not shown.

362
src/Data.java Normal file
View 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;
}
}

View File

@@ -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);
} }
} }

View File

@@ -1,2 +0,0 @@
public class FDtest {
}

View File

@@ -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
View 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
View 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
View 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")) {
}
}
}

View File

@@ -1,7 +0,0 @@
public class TestKlasse {
public String Satz()
{
return "Satz";
}
}

85
src/User.java Normal file
View 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;
}
}

2
user.txt Normal file
View File

@@ -0,0 +1,2 @@
Felix Düsterhaus;Sabine Gubitz;Detmolderstrasse 101,33102 Paderborn;1234567;Lisa,Peter;12345
Kevin Pfannenstiel;Marlene Pfannenstiel;Fürstenallee 30, 33102 Paderborn;7654321;Anton;12345