Initial sharing of project
commit
f01f19d333
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Minimumsuche.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
import java.util.Random;
|
||||||
|
public class Minimum{
|
||||||
|
static Random r = new Random();
|
||||||
|
static int[] a = new int[20];
|
||||||
|
public static int Zufallszahl(){
|
||||||
|
return r.nextInt(50);
|
||||||
|
}
|
||||||
|
public static void main(){
|
||||||
|
for (int i = 0; i < a.length; i++){
|
||||||
|
a[i] = Zufallszahl();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < a.length; i++){
|
||||||
|
System.out.print(a[i]);
|
||||||
|
System.out.print(",");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
//Liste sortiert ausgeben
|
||||||
|
for (int i = 0; i< a.length; i++){
|
||||||
|
int index = Minimum(a);
|
||||||
|
System.out.println("Minimum: " + a[index]);
|
||||||
|
System.out.println("Index: " + index);
|
||||||
|
a[index] = 99;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int Minimum(int[] a){
|
||||||
|
int minNum = a[0];
|
||||||
|
int minInd = 0;
|
||||||
|
for (int i = 1; i < a.length; i++){
|
||||||
|
if (a[i] < minNum){
|
||||||
|
minNum = a[i];
|
||||||
|
minInd = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// System.out.println("kleinste Zahl: " + minNum + ", Index der kleinsten Zahl: " + minInd);
|
||||||
|
return minInd;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
Dies ist die README-Datei des Projekts. Hier sollten Sie Ihr Projekt
|
||||||
|
beschreiben.
|
||||||
|
Erzählen Sie dem Leser (jemand, der nichts über dieses Projekt weiss),
|
||||||
|
alles, was er/sie wissen muss. Üblicherweise sollte der Kommentar
|
||||||
|
zumindest die folgenden Angaben umfassen:
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PROJEKTBEZEICHNUNG:
|
||||||
|
PROJEKTZWECK:
|
||||||
|
VERSION oder DATUM:
|
||||||
|
WIE IST DAS PROJEKT ZU STARTEN:
|
||||||
|
AUTOR(EN):
|
||||||
|
BENUTZERHINWEISE:
|
|
@ -0,0 +1,32 @@
|
||||||
|
#BlueJ package file
|
||||||
|
editor.fx.0.height=1150
|
||||||
|
editor.fx.0.width=2240
|
||||||
|
editor.fx.0.x=-1
|
||||||
|
editor.fx.0.y=26
|
||||||
|
objectbench.height=100
|
||||||
|
objectbench.width=776
|
||||||
|
package.divider.horizontal=0.6
|
||||||
|
package.divider.vertical=0.8003731343283582
|
||||||
|
package.editor.height=422
|
||||||
|
package.editor.width=661
|
||||||
|
package.editor.x=60
|
||||||
|
package.editor.y=64
|
||||||
|
package.frame.height=600
|
||||||
|
package.frame.width=800
|
||||||
|
package.numDependencies=0
|
||||||
|
package.numTargets=1
|
||||||
|
package.showExtends=true
|
||||||
|
package.showUses=true
|
||||||
|
project.charset=UTF-8
|
||||||
|
readme.height=60
|
||||||
|
readme.name=@README
|
||||||
|
readme.width=48
|
||||||
|
readme.x=10
|
||||||
|
readme.y=10
|
||||||
|
target1.height=70
|
||||||
|
target1.name=Minimum
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=ClassTarget
|
||||||
|
target1.width=120
|
||||||
|
target1.x=70
|
||||||
|
target1.y=10
|
Loading…
Reference in New Issue