This commit is contained in:
Your Name
2023-10-23 17:02:51 +02:00
parent ac7ddd9310
commit 5abb0fab2a
7 changed files with 115 additions and 2 deletions

4
.idea/modules.xml generated
View File

@@ -2,8 +2,8 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/Anwendungsentwicklung/Anwendungsentwicklung.iml" filepath="$PROJECT_DIR$/Anwendungsentwicklung/Anwendungsentwicklung.iml" /> <module fileurl="file://$PROJECT_DIR$/WS23_24/Anwendungsentwicklung/Anwendungsentwicklung.iml" filepath="$PROJECT_DIR$/WS23_24/Anwendungsentwicklung/Anwendungsentwicklung.iml" />
<module fileurl="file://$PROJECT_DIR$/AuD/AuD.iml" filepath="$PROJECT_DIR$/AuD/AuD.iml" /> <module fileurl="file://$PROJECT_DIR$/SS23/AuD/AuD.iml" filepath="$PROJECT_DIR$/SS23/AuD/AuD.iml" />
<module fileurl="file://$PROJECT_DIR$/FH.iml" filepath="$PROJECT_DIR$/FH.iml" /> <module fileurl="file://$PROJECT_DIR$/FH.iml" filepath="$PROJECT_DIR$/FH.iml" />
</modules> </modules>
</component> </component>

View File

@@ -0,0 +1,16 @@
package P4;
import java.util.Random;
import java.util.TreeSet;
public class Lotto {
public static void main(String[] args) {
var rand = new Random();
var set = new TreeSet<Integer>();
while(set.size()<6)
set.add(rand.nextInt(1,50));
for(int i:set)
System.out.println(i);
}
}

View File

@@ -0,0 +1,57 @@
package P4;
import java.util.Set;
import java.util.TreeSet;
public class Sets {
static char[] a = {'a', 'b', 'c'};
static char[] b = {'b', 'c', 'd'};
public static void main(String[] args) {
System.out.println("A: ");
for (char c:a) {
System.out.println(c);
}
System.out.println("B: ");
for (char c:b) {
System.out.println(c);
}
System.out.println("Vereinigung: ");
var set = new TreeSet<Character>();
for (char c:a)
set.add(c);
for (char c:b)
set.add(c);
for (char c:set)
System.out.println(c);
System.out.println("Schnitt: ");
for (char ca:a)
for (char cb:b)
if(ca == cb)
System.out.println(ca);
System.out.println("DiffT");
var setA = new TreeSet<Character>();
setA.add('a');
setA.add('b');
setA.add('c');
var setB = new TreeSet<Character>();
setB.add('b');
setB.add('c');
setB.add('d');
var newSet = new TreeSet<Character>();
newSet.addAll(setA);
newSet.removeAll(setB);
for(char c:newSet)
System.out.println(c);
}
}

View File

@@ -0,0 +1,40 @@
package P4;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Tabelle{
public static void main(String[] args) {
double[][] matrix = {
{1.0, 2.0, 3.0},
{4.0, 5.0, 6.0},
{4.0, 5.0, 9.0},
{1.0, 3.0, 12.0},
{4.0, 2.0, 15.0}};
var treeMap = new TreeMap<Double,Integer>();
var set = new HashSet<Double>();
for(double d:set)
treeMap.put(d,0);
List l = new ArrayList();
for(int x=0;x<matrix[0].length;x++){
for(int y=0 ;y < matrix.length;y++){
l.add(matrix[y][x]);
}
Map<Double,Integer> counted = (Map<Double, Integer>) l.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
System.out.println(counted);
}
}
}

Binary file not shown.

Binary file not shown.