File tree Expand file tree Collapse file tree 7 files changed +89
-1
lines changed
External Plug-in Libraries
src/com/vogella/ide/counter Expand file tree Collapse file tree 7 files changed +89
-1
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments