Skip to content

Commit c8b2141

Browse files
committed
initial commit
solution for tasks 1 and 2;
0 parents  commit c8b2141

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package de.dhbwka.exercise.datatypes;
2+
3+
/**
4+
* @author Leonhard Gahr
5+
*/
6+
public class Round {
7+
public static void main(String[] args) {
8+
double pi = 3.1515926;
9+
double e = 2.7182818;
10+
11+
int piInt = round(pi);
12+
int eInt = round(e);
13+
14+
System.out.println(piInt);
15+
System.out.println(eInt);
16+
}
17+
18+
private static int round(double value) {
19+
int intValue = (int) value;
20+
if (value - intValue >= 0.5) {
21+
return intValue + 1;
22+
}
23+
return intValue;
24+
}
25+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package de.dhbwka.exercise.datatypes;
2+
3+
/**
4+
* @author Leonhard Gahr
5+
*/
6+
public class ShortValue {
7+
public static void main(String[] args) {
8+
short value = 32767;
9+
System.out.println(value);
10+
11+
value++;
12+
System.out.println(value);
13+
}
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package de.dhbwka.exercise.packages;
2+
3+
public class HelloWorld {
4+
5+
public static void main(String[] args) {
6+
System.out.println("Hello World!");
7+
}
8+
}

0 commit comments

Comments
 (0)