First develop commit. Adding all existing files.

This commit is contained in:
2014-03-14 20:12:38 +01:00
parent bf68ba4560
commit 73e62547ff
441 changed files with 247478 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
package diesunddas;
import java.util.Arrays;
public class Rekursiv {
double array[];
public Rekursiv(double[] arra){
array = arra;
}
public int länge(){
return länge(0);
}
public int länge(int z){
z++;
try{
@SuppressWarnings("unused")
double test = array[z];
return länge(z);
} catch(Exception e){
return z;
}
}
/**
* @param args
*/
public static void main(String[] args) {
Rekursiv arr = new Rekursiv(new double[]{0,1,2,3});
System.out.println(Arrays.toString(arr.array));
System.out.println(arr.länge());
}
}

View File

@@ -0,0 +1,52 @@
package diesunddas;
public class Strecke{
enum Einheit{
m(1),
km(1e3),
cm(0.01),
mm(0.001);
private double faktor;
Einheit(){}
Einheit(double faktor){ this.faktor = faktor; }
double faktor(){ return faktor; }
}
double länge;
Einheit einheit = Einheit.m;
public Strecke(double länge){
this.länge = länge;
}
public Strecke(double länge, Einheit einheit){
this.länge = länge;
this.einheit = einheit;
}
public Strecke plus(Strecke dazu){
return new Strecke(länge+dazu.länge*dazu.einheit.faktor()/einheit.faktor(), einheit);
}
@Override
public String toString(){
return länge+" "+einheit;
}
/**
* @param args
*/
public static void main(String[] args) {
Strecke heimweg = new Strecke(10, Einheit.km);
Strecke bäcker = new Strecke(420, Einheit.m);
System.out.println(heimweg);
System.out.println(bäcker);
System.out.println(heimweg.plus(bäcker));
System.out.println(bäcker.plus(heimweg));
}
}

View File

@@ -0,0 +1,52 @@
package diesunddas;
/**
* @author Daniel Weschke
*
*/
public class Würfel{
/**
* Würfelname
*/
private int würfel = 1;
/**
* Maximale Würfelaugen / Anzahl der Flächen
*/
private int augen = 6;
public Würfel(int würfel){
this.würfel = würfel;
}
public Würfel(int würfel, int augen){
this.würfel = würfel;
this.augen = augen;
}
public int getWürfel(){
return würfel;
}
// TODO
public int add(Würfel würfel){
return wurf() + würfel.wurf();
}
public int wurf(){
return (int) (Math.random()*augen+1);
}
/**
* @param args
*/
public static void main(String[] args) {
Würfel w = new Würfel(3);
for(int i=0;i<20; i++) System.out.println(w.wurf());
System.out.println();
Würfel w2 = new Würfel(5,9);
for(int i=0;i<20; i++) System.out.println(w2.wurf());
}
}