diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index fcebfaf..852f901 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,10 +7,6 @@
-
-
-
-
@@ -41,8 +37,8 @@
-
-
+
+
@@ -51,8 +47,8 @@
-
-
+
+
@@ -71,8 +67,8 @@
-
-
+
+
@@ -83,7 +79,12 @@
-
+
+
+
+
+
+
@@ -101,8 +102,8 @@
-
-
+
+
@@ -172,9 +173,6 @@
-
-
-
@@ -227,6 +225,9 @@
+
+
+
@@ -243,7 +244,7 @@
-
+
@@ -671,11 +672,12 @@
+
-
+
@@ -750,7 +752,12 @@
-
+
+
+
+
+
+
@@ -798,7 +805,12 @@
-
+
+
+
+
+
+
@@ -846,7 +858,12 @@
-
+
+
+
+
+
+
@@ -894,7 +911,12 @@
-
+
+
+
+
+
+
@@ -942,7 +964,12 @@
-
+
+
+
+
+
+
@@ -982,7 +1009,12 @@
-
+
+
+
+
+
+
@@ -1014,7 +1046,12 @@
-
+
+
+
+
+
+
@@ -1046,7 +1083,12 @@
-
+
+
+
+
+
+
@@ -1090,6 +1132,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1098,42 +1153,34 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
diff --git a/out/production/Textanalyse/com/structix/Analyse.class b/out/production/Textanalyse/com/structix/Analyse.class
index 9c8d237..efb6e6b 100644
Binary files a/out/production/Textanalyse/com/structix/Analyse.class and b/out/production/Textanalyse/com/structix/Analyse.class differ
diff --git a/out/production/Textanalyse/com/structix/CommandLineInterface.class b/out/production/Textanalyse/com/structix/CommandLineInterface.class
index 11df709..b929d56 100644
Binary files a/out/production/Textanalyse/com/structix/CommandLineInterface.class and b/out/production/Textanalyse/com/structix/CommandLineInterface.class differ
diff --git a/out/production/Textanalyse/com/structix/Main.class b/out/production/Textanalyse/com/structix/Main.class
index ccff005..87aef5a 100644
Binary files a/out/production/Textanalyse/com/structix/Main.class and b/out/production/Textanalyse/com/structix/Main.class differ
diff --git a/out/production/Textanalyse/com/structix/Menu.class b/out/production/Textanalyse/com/structix/Menu.class
index e95b855..2c176ac 100644
Binary files a/out/production/Textanalyse/com/structix/Menu.class and b/out/production/Textanalyse/com/structix/Menu.class differ
diff --git a/src/com/structix/Analyse.java b/src/com/structix/Analyse.java
index 4625c97..22b5e7c 100644
--- a/src/com/structix/Analyse.java
+++ b/src/com/structix/Analyse.java
@@ -259,4 +259,32 @@ public class Analyse {
return max;
}
+
+ public String hauefigkeitBuchstaben(String muster) {
+ char buchstaben[] = muster.toLowerCase().toCharArray();
+ int anzahl[] = new int[buchstaben.length];
+ char allebuchstaben[] = inhalt.toLowerCase().toCharArray();
+ String output = "";
+ //Anzahl Array mit 0 initialisieren
+ for (int i = 0; i < anzahl.length; i++) {
+ anzahl[i] = 0;
+ }
+
+
+ for (int i = 0; i < allebuchstaben.length; i++) {
+ for (int z = 0; z < buchstaben.length; z++) {
+ if (allebuchstaben[i] == buchstaben[z]) {
+ anzahl[z] += 1;
+ }
+ }
+ }
+
+ for (int i = 0; i < buchstaben.length; i++) {
+ output += buchstaben[i] + ": " + anzahl[i] + " (" + prozentsatz(anzahl[i], allebuchstaben.length) + "%)\n";
+ }
+ return output;
+ }
+
+
+
}
diff --git a/src/com/structix/CommandLineInterface.java b/src/com/structix/CommandLineInterface.java
index b35e0b7..b0a2459 100644
--- a/src/com/structix/CommandLineInterface.java
+++ b/src/com/structix/CommandLineInterface.java
@@ -9,11 +9,14 @@ public class CommandLineInterface {
private String cmds[];
private String cmdseinzeln[];
- private String kommandos[] = {"-h", "-?", "--help", "--credits", "-w", "-v", "-b", "-ha", "-sl", "-tw", "-tb", "-tl"};
+ private String kommandos[] = {"-h", "-?", "--help", "--credits", "-w", "-v", "-b", "-ha", "-sl", "-tw", "-tb",
+ "-tl", "-bz"};
+
private String hilfe[] = {"Hilfe", "Hilfe", "Hilfe", "Credits", "Anzahl der Wörter",
"Anzahl der verwschiedenen Wörter", "Anzahl der Buchstaben", "Häufigkeit der Wörter",
"Anteil der Leerzeichen im Text", "Textformatierung nach Anzahl der Wörter pro Zeile",
- "Textformatierung nach Anzahl der Buchstaben pro Zeile", "Textformatierung: Längstes Wort"};
+ "Textformatierung nach Anzahl der Buchstaben pro Zeile", "Textformatierung: Längstes Wort",
+ "Buchstaben zählen"};
String dateipfad = "";
int dateipfadstelle = -1;
@@ -108,6 +111,10 @@ public class CommandLineInterface {
case "-tl":
System.out.println("Buchstaben des längsten Wortes: " + an.laengstesWort());
break;
+ case "-bz":
+ System.out.println("Bitte geben Sie alle Buchstaben ein, wonach gesucht werden soll (Bsp.: abcd): ");
+ System.out.println(an.hauefigkeitBuchstaben(eingabe.nextLine()));
+ break;
}
}
}
@@ -135,15 +142,15 @@ public class CommandLineInterface {
String tempCmds[] = new String[cmds.length];
boolean vorhanden;
int tbelegt = 0;
- for (int i = 0; i < cmds.length; i++) {
+ for (String cmd : cmds) {
vorhanden = false;
for (int z = 0; z < tempCmds.length; z++) {
- if (cmds[i].equals(tempCmds[z])) {
+ if (cmd.equals(tempCmds[z])) {
vorhanden = true;
}
}
if (!vorhanden) {
- tempCmds[tbelegt] = cmds[i];
+ tempCmds[tbelegt] = cmd;
tbelegt++;
}
}
diff --git a/src/com/structix/Main.java b/src/com/structix/Main.java
index dfcf45f..a741034 100644
--- a/src/com/structix/Main.java
+++ b/src/com/structix/Main.java
@@ -29,6 +29,7 @@ package com.structix;
* 20.05.16: 11:18 - 12:32 Uhr
* 24:05.16: 17:46 - 19:17 Uhr
* 25.05.16: 10:47 - 11:32 Uhr
+ * 26.05.16: 11:34 - 11:57 Uhr
*/
public class Main {
diff --git a/src/com/structix/Menu.java b/src/com/structix/Menu.java
index 1d2a15a..a12c533 100644
--- a/src/com/structix/Menu.java
+++ b/src/com/structix/Menu.java
@@ -76,7 +76,7 @@ public class Menu {
boolean exit = false;
int auswahl = 0;
//Menü wird wieder mit Strings befüllt und der Rückgabe Wert der Variable auswahl zugeordnet
- auswahl = statsmenu.menuAnzeigen(new String[]{"Enthaltene Leerzeichen", "Häufigkeit der verschiedenen Wörter"}, "||");
+ auswahl = statsmenu.menuAnzeigen(new String[]{"Enthaltene Leerzeichen", "Häufigkeit der verschiedenen Wörter", "Häufigkeit aller Buchstaben", "Häufigkeit einzelner Buchstaben"}, "||");
//Fallunterscheidung der Variable auswahl
switch (auswahl) {
case 1:
@@ -85,6 +85,13 @@ public class Menu {
case 2:
ausgabe(an.haeufigkeit());
break;
+ case 3:
+ System.out.println(an.hauefigkeitBuchstaben("abcdefghijklmnopqrstuvwxyz"));
+ break;
+ case 4:
+ System.out.println("Bitte geben Sie alle Buchstaben ein, wonach gesucht werden soll (Bsp.: abcd): ");
+ System.out.println(an.hauefigkeitBuchstaben(eingabe.nextLine()));
+ break;
default:
exit = true;
break; //Nicht zwingend notwendig