mirror of
https://github.com/DerTyp7/lf05-java.git
synced 2025-10-29 04:22:12 +01:00
add stuff
This commit is contained in:
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>
|
||||
@@ -7,5 +7,21 @@
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="17" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="JUnit5.7.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
36
src/fussball/Ergebnis.java
Normal file
36
src/fussball/Ergebnis.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package fussball;
|
||||
|
||||
public class Ergebnis {
|
||||
private int tore1;
|
||||
private int tore2;
|
||||
|
||||
|
||||
public Ergebnis(int tore1, int tore2) {
|
||||
this.tore1 = tore1;
|
||||
this.tore2 = tore2;
|
||||
}
|
||||
|
||||
public void addTor1(){
|
||||
this.tore1 += 1;
|
||||
}
|
||||
|
||||
public void addTor2(){
|
||||
this.tore2 += 1;
|
||||
}
|
||||
|
||||
public int getTore1() {
|
||||
return tore1;
|
||||
}
|
||||
|
||||
public void setTore1(int tore1) {
|
||||
this.tore1 = tore1;
|
||||
}
|
||||
|
||||
public int getTore2() {
|
||||
return tore2;
|
||||
}
|
||||
|
||||
public void setTore2(int tore2) {
|
||||
this.tore2 = tore2;
|
||||
}
|
||||
}
|
||||
72
src/fussball/Mannschaft.java
Normal file
72
src/fussball/Mannschaft.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package fussball;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Mannschaft {
|
||||
private String name;
|
||||
private Torwart torwart;
|
||||
private Trainer trainer;
|
||||
private ArrayList<Spieler> spielerList;
|
||||
|
||||
|
||||
public Mannschaft(String name, Torwart torwart, Trainer trainer, ArrayList<Spieler> spielerList) {
|
||||
this.name = name;
|
||||
this.torwart = torwart;
|
||||
this.trainer = trainer;
|
||||
this.spielerList = spielerList;
|
||||
}
|
||||
|
||||
public int getMotivation(){
|
||||
int motivation = 0;
|
||||
|
||||
for (Spieler spieler: spielerList) {
|
||||
motivation += spieler.getMotivation();
|
||||
}
|
||||
motivation += torwart.getMotivation();
|
||||
|
||||
return (motivation / (spielerList.size() + 1));
|
||||
}
|
||||
|
||||
public int getStaerke(){
|
||||
int staerke = 0;
|
||||
|
||||
for (Spieler spieler: spielerList) {
|
||||
staerke += spieler.getStaerke();
|
||||
}
|
||||
staerke += torwart.getStaerke();
|
||||
|
||||
return (staerke / (spielerList.size() + 1));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Torwart getTorwart() {
|
||||
return torwart;
|
||||
}
|
||||
|
||||
public void setTorwart(Torwart torwart) {
|
||||
this.torwart = torwart;
|
||||
}
|
||||
|
||||
public Trainer getTrainer() {
|
||||
return trainer;
|
||||
}
|
||||
|
||||
public void setTrainer(Trainer trainer) {
|
||||
this.trainer = trainer;
|
||||
}
|
||||
|
||||
public ArrayList<Spieler> getSpielerList() {
|
||||
return spielerList;
|
||||
}
|
||||
|
||||
public void setSpielerList(ArrayList<Spieler> spielerList) {
|
||||
this.spielerList = spielerList;
|
||||
}
|
||||
}
|
||||
28
src/fussball/Person.java
Normal file
28
src/fussball/Person.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package fussball;
|
||||
|
||||
public abstract class Person {
|
||||
private String name;
|
||||
private int alter;
|
||||
|
||||
|
||||
public Person(String name, int alter){
|
||||
this.name = name;
|
||||
this.alter = alter;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAlter() {
|
||||
return alter;
|
||||
}
|
||||
|
||||
public void setAlter(int alter) {
|
||||
this.alter = alter;
|
||||
}
|
||||
}
|
||||
7
src/fussball/Programm.java
Normal file
7
src/fussball/Programm.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package fussball;
|
||||
|
||||
public class Programm {
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
35
src/fussball/Spiel.java
Normal file
35
src/fussball/Spiel.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package fussball;
|
||||
|
||||
public class Spiel {
|
||||
private Mannschaft heim;
|
||||
private Mannschaft gast;
|
||||
private Ergebnis ergebnis;
|
||||
private StringBuilder spielverlauf;
|
||||
|
||||
public Spiel(Mannschaft heim, Mannschaft gast, Ergebnis ergebnis, StringBuilder spielverlauf) {
|
||||
this.heim = heim;
|
||||
this.gast = gast;
|
||||
this.ergebnis = ergebnis;
|
||||
this.spielverlauf = spielverlauf;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return heim.getName() + ": " + ergebnis.getTore1() ;
|
||||
}
|
||||
|
||||
public Mannschaft getHeim() {
|
||||
return heim;
|
||||
}
|
||||
|
||||
public Mannschaft getGast() {
|
||||
return gast;
|
||||
}
|
||||
|
||||
public Ergebnis getErgebnis() {
|
||||
return ergebnis;
|
||||
}
|
||||
|
||||
public StringBuilder getSpielverlauf() {
|
||||
return spielverlauf;
|
||||
}
|
||||
}
|
||||
66
src/fussball/Spieler.java
Normal file
66
src/fussball/Spieler.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package fussball;
|
||||
|
||||
public class Spieler {
|
||||
private String name;
|
||||
private int alter;
|
||||
private int staerke;
|
||||
private int torschuss;
|
||||
private int motivation;
|
||||
private int tore;
|
||||
|
||||
void Spieler(String name, int staerke, int torschuss, int motivation, int tore){
|
||||
this.name = name;
|
||||
this.staerke = staerke;
|
||||
this.torschuss = torschuss;
|
||||
this.motivation = motivation;
|
||||
this.tore = tore;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAlter() {
|
||||
return alter;
|
||||
}
|
||||
|
||||
public void setAlter(int alter) {
|
||||
this.alter = alter;
|
||||
}
|
||||
|
||||
public int getStaerke() {
|
||||
return staerke;
|
||||
}
|
||||
|
||||
public void setStaerke(int staerke) {
|
||||
this.staerke = staerke;
|
||||
}
|
||||
|
||||
public int getTorschuss() {
|
||||
return torschuss;
|
||||
}
|
||||
|
||||
public void setTorschuss(int torschuss) {
|
||||
this.torschuss = torschuss;
|
||||
}
|
||||
|
||||
public int getMotivation() {
|
||||
return motivation;
|
||||
}
|
||||
|
||||
public void setMotivation(int motivation) {
|
||||
this.motivation = motivation;
|
||||
}
|
||||
|
||||
public int getTore() {
|
||||
return tore;
|
||||
}
|
||||
|
||||
public void setTore(int tore) {
|
||||
this.tore = tore;
|
||||
}
|
||||
}
|
||||
13
src/fussball/Torwart.java
Normal file
13
src/fussball/Torwart.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package fussball;
|
||||
|
||||
public class Torwart extends Spieler{
|
||||
private int reaktion;
|
||||
|
||||
public int getReaktion() {
|
||||
return reaktion;
|
||||
}
|
||||
|
||||
public void setReaktion(int reaktion) {
|
||||
this.reaktion = reaktion;
|
||||
}
|
||||
}
|
||||
24
src/fussball/Trainer.java
Normal file
24
src/fussball/Trainer.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package fussball;
|
||||
|
||||
public class Trainer extends Person{
|
||||
private int erfahrung;
|
||||
|
||||
public Trainer(String name, int alter, int erfahrung){
|
||||
super(name, alter);
|
||||
this.erfahrung = erfahrung;
|
||||
}
|
||||
|
||||
public int getErfahrung(){
|
||||
return this.erfahrung;
|
||||
}
|
||||
|
||||
public void setErfahrung(int newErfahrung){
|
||||
this.erfahrung = newErfahrung;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
String erfahrungStr = "Erfahrung: " + this.erfahrung + "\n";
|
||||
|
||||
return erfahrungStr;
|
||||
}
|
||||
}
|
||||
15
src/motorrad/Motorrad.java
Normal file
15
src/motorrad/Motorrad.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package motorrad;
|
||||
|
||||
public class Motorrad extends Vehicle{
|
||||
|
||||
|
||||
@Override
|
||||
public void bremsen() {
|
||||
System.out.println("Bremsen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beschleunigen() {
|
||||
System.out.println("fahren");
|
||||
}
|
||||
}
|
||||
10
src/motorrad/Programm.java
Normal file
10
src/motorrad/Programm.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package motorrad;
|
||||
|
||||
public class Programm {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Motorrad motorrad = new Motorrad();
|
||||
|
||||
motorrad.bremsen();
|
||||
}
|
||||
}
|
||||
7
src/motorrad/Vehicle.java
Normal file
7
src/motorrad/Vehicle.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package motorrad;
|
||||
|
||||
public abstract class Vehicle {
|
||||
|
||||
public abstract void bremsen();
|
||||
public abstract void beschleunigen();
|
||||
}
|
||||
10
src/rekursion/Fakultaet.java
Normal file
10
src/rekursion/Fakultaet.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package rekursion;
|
||||
|
||||
public class Fakultaet {
|
||||
public static void fak(){
|
||||
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
6
src/rollenspiel/Character.java
Normal file
6
src/rollenspiel/Character.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package rollenspiel;
|
||||
|
||||
public class Character {
|
||||
private String name;
|
||||
|
||||
}
|
||||
4
src/rollenspiel/Rollenspiel.java
Normal file
4
src/rollenspiel/Rollenspiel.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package rollenspiel;
|
||||
|
||||
public class Rollenspiel {
|
||||
}
|
||||
25
src/singletonPattern/Singleton.java
Normal file
25
src/singletonPattern/Singleton.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package singletonPattern;
|
||||
|
||||
public class Singleton {
|
||||
private static Singleton instance;
|
||||
private String speicherOrt;
|
||||
|
||||
private Singleton(String speicherOrt){
|
||||
this.speicherOrt = speicherOrt;
|
||||
}
|
||||
|
||||
public static Singleton getInstance() {
|
||||
if(instance == null){
|
||||
instance = new Singleton("test");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String getSpeicherOrt() {
|
||||
return speicherOrt;
|
||||
}
|
||||
|
||||
public void setSpeicherOrt(String speicherOrt) {
|
||||
this.speicherOrt = speicherOrt;
|
||||
}
|
||||
}
|
||||
9
src/singletonPattern/SingletonMain.java
Normal file
9
src/singletonPattern/SingletonMain.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package singletonPattern;
|
||||
|
||||
public class SingletonMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Singleton.getInstance().getSpeicherOrt());
|
||||
}
|
||||
|
||||
}
|
||||
18
src/spielwiese/DreiGewinnt.java
Normal file
18
src/spielwiese/DreiGewinnt.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package spielwiese;
|
||||
|
||||
public class DreiGewinnt {
|
||||
public static void createGrid(int width, int height) {
|
||||
System.out.print(" | ");
|
||||
for (int i = 0; i < width; i++) {
|
||||
System.out.print((i + 1) + " | ");
|
||||
for (int a = 0; a < height; a++) {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
createGrid(5, 10);
|
||||
}
|
||||
}
|
||||
22
src/unit/Pq1.java
Normal file
22
src/unit/Pq1.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package unit;
|
||||
|
||||
public class Pq1 {
|
||||
|
||||
public static double[] pq(double p, double q){
|
||||
double[] result = new double[2];
|
||||
|
||||
double d = Math.pow(p/2, 2) - q;
|
||||
|
||||
result[0] = -(p/2) + Math.sqrt(d);
|
||||
result[1] = -(p/2) - Math.sqrt(d);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
double[] result = pq(1, -7);
|
||||
|
||||
System.out.println(result[0]);
|
||||
System.out.println(result[1]);
|
||||
}
|
||||
}
|
||||
34
src/unit/Test1.java
Normal file
34
src/unit/Test1.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package unit;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class Test1 {
|
||||
|
||||
@Test
|
||||
void givenPQ_whenSingleSolution_solutionOk(){
|
||||
assertEquals(Double.NaN, unit.Pq1.pq(1,1)[0], "Sehr hilfreiche Message");
|
||||
assertEquals(Double.NaN, unit.Pq1.pq(1,1)[0], "Noch eine sehr hilfreiche Message");
|
||||
assertEquals(Double.NaN, unit.Pq1.pq(1,1)[0], "Eine weitere unglaublich hilfreiche Message");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("givenPQ_whenDoubleSolution_solutionOk")
|
||||
void givenPQ_whenSingleSolution_solutionOk(double p, double q){
|
||||
assertEquals(Double.NaN, unit.Pq1.pq(1,1)[0], "Sehr hilfreiche Message");
|
||||
}
|
||||
|
||||
static Stream<Arguments> givenPQ_whenDoubleSolution_solutionOk(){
|
||||
return Stream.of(
|
||||
Arguments.of(4,4,-2),
|
||||
Arguments.of(4,3,-2)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,14 +18,11 @@ public class Wuerfeln {
|
||||
wuerfe[i][a] = (int)(Math.random()*6)+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < anzahlExperimente; i++){
|
||||
for(int a = 0; a < anzahlWuerfe; a++){
|
||||
System.out.print(wuerfe[i][a] +" ");
|
||||
}
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user