backup
This commit is contained in:
2
6/.gitingore
Normal file
2
6/.gitingore
Normal file
@@ -0,0 +1,2 @@
|
||||
*.class
|
||||
*.~ava
|
||||
BIN
6/Aufgabe.class
Normal file
BIN
6/Aufgabe.class
Normal file
Binary file not shown.
29
6/Aufgabe.java
Normal file
29
6/Aufgabe.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
public class Aufgabe {
|
||||
public static void main(String args[]) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
int a;
|
||||
int b;
|
||||
|
||||
try {
|
||||
System.out.print("A = ");
|
||||
a = input.nextInt();
|
||||
System.out.print("B = ");
|
||||
b = input.nextInt();
|
||||
|
||||
System.out.println("a : b = " + a/b);
|
||||
} catch(ArithmeticException e) {
|
||||
System.out.println("Bei der Berechnung gab es Problem");
|
||||
System.out.println("Problem: Dividiederen durch Null");
|
||||
} catch (InputMismatchException e) {
|
||||
System.out.println("Geben Sie ganzzahlige Zahl");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
6/Aufgabe.uml
Normal file
13
6/Aufgabe.uml
Normal file
@@ -0,0 +1,13 @@
|
||||
[Diagram]
|
||||
comments=0
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
Visibility=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
ShowConnections=0
|
||||
Fontname=Segoe UI
|
||||
Fontsize=11
|
||||
ShowObjectDiagram=0
|
||||
|
||||
30
6/Aufgabe.~ava
Normal file
30
6/Aufgabe.~ava
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
public class Aufgabe {
|
||||
public static void main(String args[]) {
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.println(6.7 / 0);
|
||||
int a;
|
||||
int b;
|
||||
|
||||
try {
|
||||
System.out.print("A = ");
|
||||
a = input.nextInt();
|
||||
System.out.print("B = ");
|
||||
b = input.nextInt();
|
||||
|
||||
System.out.println("a : b = " + (double)a/b);
|
||||
} catch(ArithmeticException e) {
|
||||
System.out.println("Bei der Berechnung gab es Problem");
|
||||
System.out.println("Problem: Dividiederen durch Null");
|
||||
} catch (InputMismatchException e) {
|
||||
System.out.println("Geben Sie ganzzahlige Zahl");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
6/Aufgabe2.class
Normal file
BIN
6/Aufgabe2.class
Normal file
Binary file not shown.
20
6/Aufgabe2.java
Normal file
20
6/Aufgabe2.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
public class Aufgabe2 {
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
System.out.println(berechneDivision(10,0));
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static int berechneDivision(int a, int b){
|
||||
if (b == 0){
|
||||
throw new IllegalArgumentException("Der Nenner darf nicht Null sein");
|
||||
}
|
||||
int c = a/b;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
13
6/Aufgabe2.uml
Normal file
13
6/Aufgabe2.uml
Normal file
@@ -0,0 +1,13 @@
|
||||
[Diagram]
|
||||
comments=0
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
Visibility=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
ShowConnections=0
|
||||
Fontname=Segoe UI
|
||||
Fontsize=11
|
||||
ShowObjectDiagram=0
|
||||
|
||||
20
6/Aufgabe2.~ava
Normal file
20
6/Aufgabe2.~ava
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.InputMismatchException;
|
||||
import java.util.Scanner;
|
||||
public class Aufgabe2 {
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
System.out.println(berechneDivision(10,5));
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static int berechneDivision(int a, int b){
|
||||
if (b == 0){
|
||||
throw new IllegalArgumentException("Der Nenner darf nicht Null sein");
|
||||
}
|
||||
int c = a/b;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
BIN
6/Dividieren.class
Normal file
BIN
6/Dividieren.class
Normal file
Binary file not shown.
18
6/Dividieren.java
Normal file
18
6/Dividieren.java
Normal file
@@ -0,0 +1,18 @@
|
||||
public class Dividieren {
|
||||
public static void main(String args[]) {
|
||||
int a = 7;
|
||||
int b = 7.9;
|
||||
try {
|
||||
System.out.println("a : b = " + a/b);
|
||||
} catch(ArithmeticException e) {
|
||||
System.out.println("Bei der Berechnung gab es Problem");
|
||||
System.out.println("Problem: "+ e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
6/Dividieren.uml
Normal file
13
6/Dividieren.uml
Normal file
@@ -0,0 +1,13 @@
|
||||
[Diagram]
|
||||
comments=0
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
Visibility=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=1
|
||||
ShowConnections=0
|
||||
Fontname=Segoe UI
|
||||
Fontsize=11
|
||||
ShowObjectDiagram=0
|
||||
|
||||
18
6/Dividieren.~ava
Normal file
18
6/Dividieren.~ava
Normal file
@@ -0,0 +1,18 @@
|
||||
public class Dividieren {
|
||||
public static void main(String args[]) {
|
||||
int a = 7;
|
||||
int b = 7.9;
|
||||
try {
|
||||
System.out.println("a : b = " + a/b);
|
||||
} catch(ArithmeticException e) {
|
||||
System.out.println("Bei der Berechnung gab es Problem");
|
||||
System.out.println("Problem: "+ e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
4
6/error.txt
Normal file
4
6/error.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Dividieren.java:4: Fehler: Inkompatible Typen: Möglicher Verlust bei Konvertierung von double in int
|
||||
int b = 7.9;
|
||||
^
|
||||
1 Fehler
|
||||
Reference in New Issue
Block a user