first commit

This commit is contained in:
2022-12-07 10:06:14 +01:00
commit 7acee63be6
40 changed files with 433 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,38 @@
import java.util.*;
class GKD{
public int c;
public static void main(String[] args){
System.out.println("a und b eingeben(durch Leerzeichen getrennt)");
Scanner sc = new Scanner(System.in);
int input1 = sc.nextInt();
int input2 = sc.nextInt();
System.out.println("Das Ergebniss von modulo ist: " + modulo(input1,input2));
System.out.println("Das Ergebnis von gdk ist: "+ gdk(input1,input2));
// ergebnis von gdk(10,25) ist 5
}
public static int modulo(int a, int b){
return b % a;
}
public static int moduloSicher(int a, int b){
if(a > 0 && b > 0){
return b % a;
}
else if(b == 0 && a > 0){
return a;
}
else if(a == 0){
return b;
}
return 0;
}
public static int gdk(int a, int b){
while(a != b){
int c = moduloSicher(a,b);
a = b;
b = c;
}
return a;
}
}

BIN
BP/GKD.class Normal file

Binary file not shown.

38
BP/GKD.java Normal file
View File

@@ -0,0 +1,38 @@
import java.util.*;
class GKD{
public int c;
public static void main(String[] args){
System.out.println("a und b eingeben(durch Leerzeichen getrennt)");
Scanner sc = new Scanner(System.in);
int input1 = sc.nextInt();
int input2 = sc.nextInt();
System.out.println("Das Ergebniss von modulo ist: " + modulo(input1,input2));
System.out.println("Das Ergebnis von gdk ist: "+ gdk(input1,input2));
// ergebnis von gdk(10,25) ist 5
}
public static int modulo(int a, int b){
return a % b;
}
public static int moduloSicher(int a, int b){
if(a > 0 && b > 0){
return a % b;
}
else if(b == 0 && a > 0){
return a;
}
else if(a == 0){
return b;
}
return 0;
}
public static int gdk(int a, int b){
while(a != b){
int c = moduloSicher(a,b);
a = b;
b = c;
}
return a;
}
}

8
EidP/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
EidP/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
EidP/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/EidP.iml" filepath="$PROJECT_DIR$/EidP.iml" />
</modules>
</component>
</project>

Binary file not shown.

View File

@@ -0,0 +1,13 @@
import java.util.*;
class AdditionMitMatrNr{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
final int martikel = 12345;
int a = sc.nextInt();
int b = sc.nextInt();
int out= martikel + a + b;
System.out.println(out);
}
}

Binary file not shown.

View File

@@ -0,0 +1,12 @@
import java.util.*;
class Polynom{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int mon1 = 5 * x;
int mon2 = mon1 + 3 * x * x;
mon1 = mon2 + x * x * x;
System.out.println(mon1);
sc.close();
}
}

11
EidP/EidP.iml Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

BIN
EidP/Ueb03/zeichen.class Normal file

Binary file not shown.

40
EidP/Ueb03/zeichen.java Normal file
View File

@@ -0,0 +1,40 @@
class zeichen{
public static void main(String args[]){
System.out.println("Hello World");
System.out.print("Hello");//zusammen mit naechsten
System.out.println(" World");
System.out.println("4*5");//nicht berechnet
System.out.println(4*5);//berechnet
System.out.println("Dies ist" + "ein Text");
System.out.println("Dies ist"
+ "ein Text");//kein zeilenumbruch
System.out.println("Dies ist ein \nText" );//Zeilenumbruch
// Zeichen
System.out.println("\u0065");//e
System.out.println("");
System.out.println("\"");// "
// Ganze Zahlen
System.out.println(2147483647);
System.out.println(2147483647+1);//integer overflow
System.out.println(0xFF);//in zahlen umgewandelt
System.out.println(0xFFFF);
System.out.println(0xFFFFFF);
System.out.println(0xFFFFFFFF);
System.out.println("0xFG");
// Gleitpunktzahlen
System.out.println("Zahl " + 0.344e-17f );
System.out.println("Zahl " + 0.344e-17f );
System.out.println("Zahl " + 0.12345678901234567890);//gerundet
System.out.println("Zahl " + 0.12345678901234567890f);//frueher gerundet
System.out.println("Summe " + (5.6 + 5.8) );//wrong
System.out.println("Summe " + (12345678.0f + 0.1f) );//0.1 ignoriert
System.out.println("Differenz " + (0.123456789f - 0.123456788f) );//0
System.out.println("Summe " + ((12345678.0f + 0.1f) + 0.41f) );//anders als \/
System.out.println("Summe " + (12345678.0f + (0.1f + 0.41f)) );
}
}

BIN
EidP/Ueb04/dose.class Normal file

Binary file not shown.

22
EidP/Ueb04/dose.java Normal file
View File

@@ -0,0 +1,22 @@
import java.util.*;
class dose{
public static void main(String args[]){
double radius = Double.parseDouble(args[0]);
double hoehe = Double.parseDouble(args[1]);
final double pi = Math.PI;
double umfang = 2*pi*radius;
double deckelflaeche = pi * radius * radius;
double mantelflaeche = umfang * hoehe;
double oberflaeche = 2*deckelflaeche + mantelflaeche;
double volumen = deckelflaeche*hoehe;
System.out.println("Umfang"+umfang+"deckelflaeche"+deckelflaeche+"mantelflaeche"+mantelflaeche+"oberflaeche"+oberflaeche+"volumen"+volumen
);
}
}

View File

@@ -0,0 +1,25 @@
import java.util.*;
class Geldanlage{
public static void main(String[] args){
System.out.println("Jahre");
Scanner sc = new Scanner(System.in);
int jahre = sc.nextInt();
System.out.println("Anlagebetrag");
sc = new Scanner(System.in);
double anlage = sc.nextDouble();
System.out.println("-------------------------------------------------------------------");
System.out.println("1 1,5 % Verzinsung ohne Bonuszahlung");
System.out.println("2 0,7 % Verzinsung mit 15 Euro Bonuszahlung");
System.out.println("3 0,4 % Verzinsung mit 20 Euro Bonuszahlung");
System.out.println("4 0,1 % Verzinsung mit 50 Euro Bonuszahlung");
System.out.println("5 Fertig");
System.out.println("--------------------------------------------------------------------");
}
}

BIN
EidP/Ueb06/a4.class Normal file

Binary file not shown.

57
EidP/Ueb06/a4.java Normal file
View File

@@ -0,0 +1,57 @@
class a4{
static int counter,counter2;
public static void main(String[] args){
char[][] arrr = {{'*','a','*'},
{'*',' '},
{'B','c','0','a'}};
char[][] arrrr = {{'*','a','*','a'},
{'*','*','*','b'},
{'B','c','0','c'}};
berechneSterneProZeile(arrr);
berechneSterneProSpalte(arrrr);
berechneAnzahlZeilen(arrrr);
}
public static void berechneSterneProZeile(char[][] arr){
System.out.println("Zeilen");
for(int i=0;i<arr.length;i++){
counter = 0;
for (int j=0;j<arr[i].length;j++){
if (arr[i][j] == '*')
counter++;
}
System.out.println( i + ": " + counter);
}
}
public static void berechneSterneProSpalte(char[][] arr){
System.out.println("Spalten");
for( int i=0; i<arr[0].length; i++){
counter = 0;
for( int j=0; j<arr.length;j++){
if(arr[j][i] == '*')
counter++;
}
System.out.println( i + ": " + counter);
}
}
public static void berechneAnzahlZeilen(char[][] arr){
counter2 = 0;
for(int i=0;i<arr.length;i++){
counter = 0;
for (int j=0;j<arr[i].length;j++){
if (arr[i][j] == '*')
counter++;
}
if (counter >= 2)
counter2++;
}
System.out.println("Anzahl" + counter2);
}
}

Binary file not shown.

View File

@@ -0,0 +1,58 @@
package Ueb07;
import java.util.*;
class Teileranzahl{
static int in = 0, counter = 0, highest = 1,tmp;
static Scanner sc;
public static void main( String[] args){
do{
System.out.println("------------------------------------------------------------------------------");
System.out.println("1 Teileranzahl für n");
System.out.println("2 Maximale Teileranzahl für die Zahlen 1 bis n");
System.out.println("3 Fertig");
System.out.println("------------------------------------------------------------------------------");
sc = new Scanner(System.in);
in = sc.nextInt();
}while(!(in==1||in==2||in==3));
switch(in){
case 1:
sc = new Scanner(System.in);
in = sc.nextInt();
System.out.println(anzahlTeiler(in));
break;
case 2:
sc = new Scanner(System.in);
in = sc.nextInt();
tmp = maxTeiler(in);
System.out.println(tmp);
System.out.println(anzahlTeiler(tmp));
break;
case 3:
return;
}
sc.close();
}
public static int anzahlTeiler(int input){
counter = 0;
for(int i=1; i<=in;i++){
if(input%i==0){
counter++;
}
}
return counter;
}
public static int maxTeiler(int input){
for(int i=1;i<input;i++){
if(anzahlTeiler(i) > anzahlTeiler(highest)){
highest = i;
}
}
return highest;
}
}

46
EidP/Ueb08/Dozent.java Normal file
View File

@@ -0,0 +1,46 @@
package Ueb08;
public class Dozent {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLehrgebiet() {
return lehrgebiet;
}
public void setLehrgebiet(String lehrgebiet) {
this.lehrgebiet = lehrgebiet;
}
public boolean isDekan() {
return dekan;
}
public void setDekan(boolean dekan) {
this.dekan = dekan;
}
public char getGeschlecht() {
return geschlecht;
}
public void setGeschlecht(char geschlecht) {
this.geschlecht = geschlecht;
}
String name, lehrgebiet;
boolean dekan=false;
char geschlecht;
public Dozent(String pName, String pLehrgebiet, char pGeschlecht){
name = pName;
lehrgebiet = pLehrgebiet;
geschlecht=pGeschlecht;
}
}

View File

@@ -0,0 +1,11 @@
package Ueb08;
public class DozentTest {
public static void main(String[] args) {
Dozent dieDozentin = new Dozent("kek","gebiet",'w');
Dozent derDekan = new Dozent("Dekan","dekanien",'m');
derDekan.setDekan(true);
System.out.println(derDekan.getGeschlecht() + derDekan.getName() + derDekan.getLehrgebiet() + derDekan.isDekan());
System.out.println(dieDozentin.getLehrgebiet());
}
}

BIN
EidP/hello.class Normal file

Binary file not shown.

7
EidP/hello.java Normal file
View File

@@ -0,0 +1,7 @@
class hello{
public static void main (String args[]){
System.out.println("Jordi Bolz");
}
}

8
EidP/out/production/EidP/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
EidP/out/production/EidP/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/EidP.iml" filepath="$PROJECT_DIR$/EidP.iml" />
</modules>
</component>
</project>

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
README.md Normal file
View File