Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vogella committed Aug 9, 2012
1 parent c39d8f1 commit ad38439
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion External Plug-in Libraries/.searchable

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions com.vogella.ide.counter/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions com.vogella.ide.counter/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.vogella.ide.counter</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions com.vogella.ide.counter/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.vogella.ide.counter.main;

public class AnotherTester {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.vogella.ide.counter.main;

import com.vogella.ide.counter.util.Counter;

public class Tester {

public static void main(String[] args) {
Counter counter = new Counter();
int result = counter.count(5);
if (result == 120) {
System.out.println("Correct");
} else {
System.out.println("False");
}
try {
counter.count(256);
} catch (RuntimeException e) {
System.out.println("Works as exepected");
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.vogella.ide.counter.util;

public class Counter {
public int count(int x) {
// TODO Check that x > 0 and smaller <= 255
// if not throw a new RuntimeException
// Example for a RuntimeException:

// throw new RuntimeException("x should be between 1 and 255");

// TODO calculate the numbers from 1 to x
// For example if x is 5, calculate
// 1 + 2 + 3 + 4 + 5

// TODO Return your calculated value
// instead of 0
return 0;
}
}

0 comments on commit ad38439

Please sign in to comment.