Skip to content

Commit ad38439

Browse files
committed
updates
1 parent c39d8f1 commit ad38439

File tree

7 files changed

+89
-1
lines changed

7 files changed

+89
-1
lines changed

External Plug-in Libraries/.searchable

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

com.vogella.ide.counter/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

com.vogella.ide.counter/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>com.vogella.ide.counter</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.7
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.7
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.vogella.ide.counter.main;
2+
3+
public class AnotherTester {
4+
5+
/**
6+
* @param args
7+
*/
8+
public static void main(String[] args) {
9+
// TODO Auto-generated method stub
10+
11+
}
12+
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.vogella.ide.counter.main;
2+
3+
import com.vogella.ide.counter.util.Counter;
4+
5+
public class Tester {
6+
7+
public static void main(String[] args) {
8+
Counter counter = new Counter();
9+
int result = counter.count(5);
10+
if (result == 120) {
11+
System.out.println("Correct");
12+
} else {
13+
System.out.println("False");
14+
}
15+
try {
16+
counter.count(256);
17+
} catch (RuntimeException e) {
18+
System.out.println("Works as exepected");
19+
}
20+
}
21+
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.vogella.ide.counter.util;
2+
3+
public class Counter {
4+
public int count(int x) {
5+
// TODO Check that x > 0 and smaller <= 255
6+
// if not throw a new RuntimeException
7+
// Example for a RuntimeException:
8+
9+
// throw new RuntimeException("x should be between 1 and 255");
10+
11+
// TODO calculate the numbers from 1 to x
12+
// For example if x is 5, calculate
13+
// 1 + 2 + 3 + 4 + 5
14+
15+
// TODO Return your calculated value
16+
// instead of 0
17+
return 0;
18+
}
19+
}

0 commit comments

Comments
 (0)