Skip to content

Commit f3a3059

Browse files
committed
adding new tasks
0 parents  commit f3a3059

File tree

74 files changed

+1796
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1796
-0
lines changed
Binary file not shown.
Binary file not shown.

Task 1/Eclipse _screenshot.jpeg

100 KB
Loading

Task 2/.classpath

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4+
<classpathentry kind="src" path="example files"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

Task 2/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Task 2</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>
Binary file not shown.

Task 2/averageNumber/.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

Task 2/averageNumber/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>averageNumber</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 numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=16
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.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=16
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package averageNumber;
2+
import javax.swing.JOptionPane;
3+
4+
public class AverageNumber {
5+
// This programs requests input form the user, calculates and displays total, positives, negatives and average
6+
7+
public static void main(String[] args) {
8+
// Declare all variables
9+
int count = 0;
10+
int positive = 0;
11+
int negative = 0;
12+
double total = 0;
13+
double average = 0.00;
14+
15+
int num;
16+
do {
17+
num = Integer.parseInt( JOptionPane.showInputDialog( "Please enter a number or enter 0 to exit"));
18+
19+
// Check if number is positive
20+
if (num > 0) {
21+
positive++;
22+
count++;
23+
}
24+
// Check if number is negative
25+
else if (num < 0) {
26+
negative++;
27+
count++;
28+
}
29+
total += num;
30+
}while( num!= 0);
31+
32+
// Calculate average
33+
average = total / count;
34+
// Display results
35+
System.out.println("positives = " + positive);
36+
System.out.println("negatives = " + negative);
37+
System.out.println("total = " + total);
38+
System.out.format("average = %.2f", average);
39+
}
40+
41+
}

Task 2/bin/example.class

3.93 KB
Binary file not shown.

Task 2/bin/example2.class

2.44 KB
Binary file not shown.

0 commit comments

Comments
 (0)