Initial sharing of project
						commit
						39901f7722
					
				
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,14 @@ | |||
| 
 | ||||
| /** | ||||
|  * Beschreiben Sie hier die Klasse HelloWorld. | ||||
|  * Meine erste Klasse | ||||
|  * zeigt "Hello World" in Konsole an | ||||
|  * Geschrieben von L. Mei am 02.12.22 | ||||
|  */ | ||||
| public class HelloWorld //Methode
 | ||||
| { | ||||
|     public static void helloWorld() //Kopf
 | ||||
|     { | ||||
|         System.out.println("Hallo Welt"); // Körper
 | ||||
|     } //Rumpf
 | ||||
| } | ||||
|  | @ -0,0 +1,115 @@ | |||
| 
 | ||||
| /** | ||||
|  * Beschreiben Sie hier die Klasse Methoden. | ||||
|  *  | ||||
|  * @author (Ihr Name)  | ||||
|  * @version (eine Versionsnummer oder ein Datum) | ||||
|  */ | ||||
| public class Methoden | ||||
| { | ||||
|     public static int quadrat(int x){ | ||||
|         int quadrat; | ||||
|         quadrat = x*x; | ||||
|         return quadrat; | ||||
|     } | ||||
| 
 | ||||
|     public static void test(int x){ | ||||
|         int ergebnis = quadrat (x);  | ||||
|         System.out.println ("Die Quadratzehl von" +x+ "ist" +ergebnis); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public static int summe(int a, int b){ | ||||
|         int ergebnis = a+b; | ||||
|         return ergebnis; //wird als rückgabewert berrechnet
 | ||||
|     } | ||||
| 
 | ||||
|     public static int differenz(int a, int b){ | ||||
|         int ergebnis = a-b; | ||||
|         return ergebnis;  | ||||
|     } | ||||
| 
 | ||||
|     public static int produkt(int a, int b){ | ||||
|         int ergebnis = a*b; | ||||
|         return ergebnis;  | ||||
|     } | ||||
| 
 | ||||
|     public static int quotient(int a, int b){ | ||||
|         int ergebnis = a/b; | ||||
|         return ergebnis; | ||||
|     } | ||||
| 
 | ||||
|     public static int term1(){  | ||||
|         return produkt(3, summe(2,5)); //wird von innen nach außen ausgeführt: zuerst summe dann das andere
 | ||||
|     } | ||||
| 
 | ||||
|     public static int term2(int x){ | ||||
|         int zaehler = summe (produkt(4,x),8); | ||||
|         int nenner = differenz (summe(8,9), produkt(3,5)); | ||||
|         return quotient (zaehler,nenner);  | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Berechnet die potenz a^b | ||||
|      */ | ||||
|     public static double potenz(double a,int b){ //obere kommentar ergänzt Überschrift
 | ||||
|         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 a; | ||||
|         } | ||||
|         else{ | ||||
|             return b; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     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*(-1); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static int round(double a){ | ||||
|         int vorkomma = (int)a; //   (int)a wandelt die Kommazahl a in eine Ganzzahl um, dabei wird nicht gerundet, sondern alles nach dem Komma abgeschnitten
 | ||||
|         double nachkomma = a- vorkomma; | ||||
|         if (nachkomma>0.5){ | ||||
|             return vorkomma+1; | ||||
|         } | ||||
|         else{ | ||||
|             return vorkomma; | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     public static boolean istGroß(int a){ | ||||
|         boolean zahl; | ||||
|         if (a>1000){ | ||||
|             return zahl = true; | ||||
|         } | ||||
|         else{ | ||||
|             return zahl = false; | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     public static boolean istBetragsmaeßigGroß(int a){ | ||||
|         boolean zahl; | ||||
|         if r | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,45 @@ | |||
| 
 | ||||
| /** | ||||
|  * Beschreiben Sie hier die Klasse Mitternachtsformelrechner. | ||||
|  *  | ||||
|  * @author (Ihr Name)  | ||||
|  * @version (eine Versionsnummer oder ein Datum) | ||||
|  */ | ||||
| import java.util.Scanner; // Klasse Scanner wird importiert
 | ||||
| public class Mitternachtsformelrechner | ||||
| { | ||||
|     public static void Mitternachtsformelrechner () | ||||
|     { | ||||
|         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 (); | ||||
|         System.out.println ("Bitte jetzt Parameter eingeben"); | ||||
|         System.out.println ("a"); | ||||
|         int a = sc.nextInt (); | ||||
|         System.out.println ("b"); | ||||
|         int b = sc.nextInt (); | ||||
|         System.out.println ("c"); | ||||
|         int c = sc.nextInt (); | ||||
|         System.out.println ("Die Lösungen der quadratischen Gleichung 1.0x^2 + -3.0x + 2.0 = 0 sind:"); //Text folgt nach Eingabe der Zahlen
 | ||||
|         System.out.println ("x1 = 2.0 und x2 = 1.0"); | ||||
|         //anfang der rechnung
 | ||||
|         double d = (b*b-4*a*c); //dient als vorbereitung für schritt 2
 | ||||
|         if (d == 0) | ||||
|         { | ||||
|         double x1 = (-b/2*a); | ||||
|         System.out.println ("x1=" + x1); | ||||
|     } | ||||
|         double Zähler1 = (-b + Math.sqrt(d)); | ||||
|         double Zähler2 = (-b - Math.sqrt(d)); | ||||
|         double x1 = (-b + Math.sqrt(d)) / (2*a); | ||||
|         double x2 = (-b - Math.sqrt(d)) / (2*a); | ||||
|         // ende der rechnung
 | ||||
|         System.out.println ("Die Lösungen der quadratischen Gleichung 1.0x°2 +-3.0x +2.0 = 0 sind:"); | ||||
|         System.out.println (x1); | ||||
|         System.out.println (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,44 @@ | |||
| 
 | ||||
| /** | ||||
|  * Beschreiben Sie hier die Klasse Schleifen. | ||||
|  *  | ||||
|  * @author (Ihr Name)  | ||||
|  * @version (eine Versionsnummer oder ein Datum) | ||||
|  */ | ||||
| import java.util.Scanner; // Klasse Scanner wird importiert
 | ||||
| public class Schleifen | ||||
| { | ||||
|    public static void A1(){ | ||||
|        for(int i=0; i<30;i++) | ||||
|        { | ||||
|            System.out.println ("Nur übung macht den Meister"); | ||||
|             | ||||
|        } | ||||
|    } | ||||
|    public static void A3a(){ | ||||
|        for(int i=1; i<=20;i++) | ||||
|        { | ||||
|            System.out.println (Methoden.quadrat(i)); //aus klasse Methode wird quadrat mit i ausgeführt
 | ||||
|    } | ||||
|     | ||||
| } | ||||
| public static void A3b(){ | ||||
|         for (int i=1; i*i<500;i++) // egl. while schleife,weil eleganter und so aber geht auch so
 | ||||
|         { | ||||
|             System.out.println (i*i); | ||||
|         } | ||||
|     } | ||||
|     public static void A5(){ | ||||
|         Scanner sc = new Scanner (System.in); | ||||
|         int zufallszahl = (int)(Math.random() *10+1); | ||||
|         System.out.println ("Erraten sie eine Zahl zwischen 1 und 10!"); | ||||
|         int guess = sc.nextInt(); | ||||
|         while ( guess != zufallszahl ) | ||||
|         { | ||||
|         int i= sc.nextInt(); | ||||
|          | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| } | ||||
| 
 | ||||
|  | @ -0,0 +1,56 @@ | |||
| #BlueJ package file | ||||
| dependency1.from=Schleifen | ||||
| dependency1.to=Methoden | ||||
| dependency1.type=UsesDependency | ||||
| editor.fx.0.height=0 | ||||
| editor.fx.0.width=0 | ||||
| editor.fx.0.x=0 | ||||
| editor.fx.0.y=0 | ||||
| objectbench.height=167 | ||||
| objectbench.width=629 | ||||
| package.divider.horizontal=0.6 | ||||
| package.divider.vertical=0.4727272727272727 | ||||
| package.editor.height=134 | ||||
| package.editor.width=499 | ||||
| package.editor.x=74 | ||||
| package.editor.y=106 | ||||
| package.frame.height=394 | ||||
| package.frame.width=653 | ||||
| package.numDependencies=1 | ||||
| package.numTargets=4 | ||||
| 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=20 | ||||
| target1.y=100 | ||||
| target2.height=70 | ||||
| target2.name=Mitternachtsformelrechner | ||||
| target2.showInterface=false | ||||
| target2.type=ClassTarget | ||||
| target2.width=170 | ||||
| target2.x=330 | ||||
| target2.y=10 | ||||
| target3.height=70 | ||||
| target3.name=HelloWorld | ||||
| target3.showInterface=false | ||||
| target3.type=ClassTarget | ||||
| target3.width=120 | ||||
| target3.x=70 | ||||
| target3.y=10 | ||||
| target4.height=70 | ||||
| target4.name=Schleifen | ||||
| target4.showInterface=false | ||||
| target4.type=ClassTarget | ||||
| target4.width=120 | ||||
| target4.x=200 | ||||
| target4.y=10 | ||||
		Loading…
	
		Reference in New Issue