Initial sharing of project
commit
4a717da125
Binary file not shown.
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Eingabe.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
public class Eingabe
|
||||||
|
{
|
||||||
|
public static void rechner()
|
||||||
|
{
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("Erste Zahl eingeben:" );
|
||||||
|
int eingabe = sc.nextInt();
|
||||||
|
System.out.println("Zweite zahl eingeben:" );
|
||||||
|
int eingabe2 = sc.nextInt();
|
||||||
|
int differenz = eingabe - eingabe2;
|
||||||
|
int produkt = eingabe * eingabe2;
|
||||||
|
int quotient = eingabe / eingabe2;
|
||||||
|
int rest = eingabe % eingabe2;
|
||||||
|
int summe = eingabe + eingabe2;
|
||||||
|
|
||||||
|
System.out.println("Summe:" + summe);
|
||||||
|
|
||||||
|
System.out.println("Differenz:" + differenz);
|
||||||
|
|
||||||
|
System.out.println("Produkt:" + produkt);
|
||||||
|
|
||||||
|
System.out.println( "Quotient:" + quotient);
|
||||||
|
|
||||||
|
System.out.println("Rest:" + rest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse HelloWorld.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HelloWorld
|
||||||
|
{
|
||||||
|
public static void helloWorld()
|
||||||
|
{
|
||||||
|
System.out.println("Hallo");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Methoden.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
public class Methoden
|
||||||
|
{
|
||||||
|
public static float quadrat(float x)
|
||||||
|
{
|
||||||
|
float quadrat = x*x;
|
||||||
|
return quadrat;
|
||||||
|
}
|
||||||
|
public static void test()
|
||||||
|
{
|
||||||
|
float a = quadrat(5);
|
||||||
|
System.out.println("Das Quadrat von 5 ist" + a);
|
||||||
|
}
|
||||||
|
public static int summe(int a,int b)
|
||||||
|
{
|
||||||
|
int summe = a+b;
|
||||||
|
System.out.println(summe);
|
||||||
|
return summe;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static int differenz( int a,int b)
|
||||||
|
{int differenz = a-b;
|
||||||
|
System.out.println(differenz);
|
||||||
|
return differenz;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static int produkt( int a,int b)
|
||||||
|
{int produkt = a*b;
|
||||||
|
System.out.println(produkt);
|
||||||
|
return produkt;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static int quotient( int a,int b)
|
||||||
|
{int quotient = a/b;
|
||||||
|
System.out.println(quotient);
|
||||||
|
return quotient;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static int term()
|
||||||
|
{ return produkt(3, summe(2,5));
|
||||||
|
}
|
||||||
|
public static double potenz(double a,int b)
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Berechnet die Potenz a hoch b
|
||||||
|
*/
|
||||||
|
double zwischenergebnis = 1;
|
||||||
|
for(int i = 0;i<b;i++ )
|
||||||
|
{
|
||||||
|
zwischenergebnis = zwischenergebnis * a;
|
||||||
|
|
||||||
|
}
|
||||||
|
return zwischenergebnis;
|
||||||
|
}
|
||||||
|
public static int max(int a ,int b)
|
||||||
|
{
|
||||||
|
if(a<b)
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int min(int a,int b)
|
||||||
|
{ if(a<b)
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int abs(int a)
|
||||||
|
{
|
||||||
|
if(a>0)
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int round(double zahl)
|
||||||
|
{
|
||||||
|
int vorkomma = (int) zahl;
|
||||||
|
double nachkomma = zahl - vorkomma;
|
||||||
|
|
||||||
|
if(nachkomma<0.5)
|
||||||
|
{
|
||||||
|
return vorkomma;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return vorkomma + 1;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean istGross(int a)
|
||||||
|
{
|
||||||
|
if(a<1000)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean istmaesigGross(int a)
|
||||||
|
{
|
||||||
|
int betrag = abs(a);
|
||||||
|
if(betrag>1000 )
|
||||||
|
{return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean istGerade(int a)
|
||||||
|
{
|
||||||
|
if(a % 2 == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean istTeilbar(int a,int b)
|
||||||
|
{
|
||||||
|
if(a % b == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean istPrim(int a)
|
||||||
|
{
|
||||||
|
for(int i=2;i< a/2;i++)
|
||||||
|
{
|
||||||
|
if(a % i == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Mitternachtsformel.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
import java.util.Scanner;
|
||||||
|
public class Mitternachtsformel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void mitternachtsformel()
|
||||||
|
{
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("Mitternachtsformelrechner");
|
||||||
|
System.out.println("Berechnet die Lösungen einer quadratischen Gleichung");
|
||||||
|
System.out.println("ax^2 + bx + c = 0");
|
||||||
|
System.out.println("Bitte jetzt Parameter eingeben");
|
||||||
|
System.out.print("a = ");
|
||||||
|
double a = sc.nextDouble();
|
||||||
|
System.out.print("b = ");
|
||||||
|
double b = sc.nextDouble();
|
||||||
|
System.out.print("c = ");
|
||||||
|
double c = sc.nextDouble();
|
||||||
|
double d = Math.sqrt(b * b - 4 * a * c);
|
||||||
|
|
||||||
|
if (d!=0)
|
||||||
|
System.out.println("Fehler weil Diskriminante kleiner 0");
|
||||||
|
double x1 = -b + Math.sqrt(b * b - 4 * a * c )/ (2 * a);
|
||||||
|
double x2 = -b - Math.sqrt(b * b - 4 * a * c)/ (2 * a);
|
||||||
|
System.out.println(" Die Lösungen der quadratischen Gleichung " + a+ "x^2+"+ b+"x +" + c + "= 0 sind:");
|
||||||
|
System.out.println("x1=" + x1 + "und" + " x2=" +x2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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,24 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beschreiben Sie hier die Klasse Schleifen.
|
||||||
|
*
|
||||||
|
* @author (Ihr Name)
|
||||||
|
* @version (eine Versionsnummer oder ein Datum)
|
||||||
|
*/
|
||||||
|
public class Schleifen
|
||||||
|
{
|
||||||
|
public static void Schleifen()
|
||||||
|
{
|
||||||
|
float i = 0;
|
||||||
|
while ( i*i<500)
|
||||||
|
{
|
||||||
|
System.out.println(Methoden.quadrat(i));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void zahlenRaten()
|
||||||
|
{
|
||||||
|
int zufallszahl = (int) (Math.random()*10+1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
#BlueJ package file
|
||||||
|
editor.fx.0.height=0
|
||||||
|
editor.fx.0.width=0
|
||||||
|
editor.fx.0.x=0
|
||||||
|
editor.fx.0.y=0
|
||||||
|
objectbench.height=163
|
||||||
|
objectbench.width=776
|
||||||
|
package.divider.horizontal=0.6
|
||||||
|
package.divider.vertical=0.6730769230769231
|
||||||
|
package.editor.height=343
|
||||||
|
package.editor.width=661
|
||||||
|
package.editor.x=0
|
||||||
|
package.editor.y=25
|
||||||
|
package.frame.height=584
|
||||||
|
package.frame.width=800
|
||||||
|
package.numDependencies=0
|
||||||
|
package.numTargets=5
|
||||||
|
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=Methoden
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=ClassTarget
|
||||||
|
target1.width=120
|
||||||
|
target1.x=140
|
||||||
|
target1.y=170
|
||||||
|
target2.height=70
|
||||||
|
target2.name=Mitternachtsformel
|
||||||
|
target2.showInterface=false
|
||||||
|
target2.type=ClassTarget
|
||||||
|
target2.width=150
|
||||||
|
target2.x=10
|
||||||
|
target2.y=90
|
||||||
|
target3.height=70
|
||||||
|
target3.name=Eingabe
|
||||||
|
target3.showInterface=false
|
||||||
|
target3.type=ClassTarget
|
||||||
|
target3.width=120
|
||||||
|
target3.x=220
|
||||||
|
target3.y=10
|
||||||
|
target4.height=70
|
||||||
|
target4.name=HelloWorld
|
||||||
|
target4.showInterface=false
|
||||||
|
target4.type=ClassTarget
|
||||||
|
target4.width=120
|
||||||
|
target4.x=60
|
||||||
|
target4.y=10
|
||||||
|
target5.height=70
|
||||||
|
target5.name=Schleifen
|
||||||
|
target5.showInterface=false
|
||||||
|
target5.type=ClassTarget
|
||||||
|
target5.width=120
|
||||||
|
target5.x=10
|
||||||
|
target5.y=170
|
Loading…
Reference in New Issue