Skip to content

Commit cd044c5

Browse files
authored
Prep Stuff
1 parent c2867cc commit cd044c5

14 files changed

+118
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "Java 17 Dev Container",
3+
"image": "mcr.microsoft.com/devcontainers/java:0-17",
4+
"customizations": {
5+
"vscode": {
6+
"extensions": [
7+
"vscjava.vscode-java-pack",
8+
"redhat.java"
9+
]
10+
}
11+
},
12+
"forwardPorts": [],
13+
"postCreateCommand": "mvn -q -DskipTests=true package || true"
14+
}

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Require YOUR_GITHUB_USERNAME as reviewer for all changes
2+
* @Tortuga-AM

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# Java-Basics-Training-Assignment-2025
2-
Review assignment of basic Java syntax
1+
# Java Fundamentals Challenges
2+
3+
Open this repo in GitHub Codespaces:
4+
[![Open in Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/YOUR_GITHUB_USERNAME/java-fundamentals-challenges)
5+
6+
## How students should work
7+
1. Fork this repository (or "Use this template" if the repo is set as a template).
8+
2. Open your fork in Codespaces (use the button above).
9+
3. Create a branch for your solution: `git checkout -b username-ch1`
10+
4. Implement methods / files in `src/main/java` and run tests with: `mvn test`
11+
5. Push your branch and open a Pull Request back to the upstream `main` branch.
12+
13+
## Ignore this:
14+
- Autograder: GitHub Actions runs `mvn test` on push and pull request.

pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>edu.classroom</groupId>
7+
<artifactId>java-fundamentals-challenges</artifactId>
8+
<version>1.0.0</version>
9+
<properties>
10+
<maven.compiler.source>17</maven.compiler.source>
11+
<maven.compiler.target>17</maven.compiler.target>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<junit.jupiter.version>5.9.3</junit.jupiter.version>
14+
</properties>
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.junit.jupiter</groupId>
18+
<artifactId>junit-jupiter</artifactId>
19+
<version>${junit.jupiter.version}</version>
20+
<scope>test</scope>
21+
</dependency>
22+
</dependencies>
23+
<build>
24+
<plugins>
25+
<!-- surefire for running tests -->
26+
<plugin>
27+
<groupId>org.apache.maven.plugins</groupId>
28+
<artifactId>maven-surefire-plugin</artifactId>
29+
<version>3.0.0-M7</version>
30+
<configuration>
31+
<useModulePath>false</useModulePath>
32+
</configuration>
33+
</plugin>
34+
</plugins>
35+
</build>
36+
</project>

src/Fundamentals.java

Whitespace-only changes.

src/PracticeChallenge1.java

Whitespace-only changes.

src/PracticeChallenge2.java

Whitespace-only changes.

src/PracticeChallenge3_Optional.java

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package challenges;
2+
3+
/**
4+
* FundamentalsPractice - small helper methods + main for manual testing.
5+
* Students will implement the methods below so unit tests can call them.
6+
*/
7+
8+
import java.util.*;
9+
10+
public class FundamentalsPractice {
11+
12+
// Ex: helper used by unit tests (students implement)
13+
public static int sum(int[] arr) {
14+
int s = 0;
15+
for (int v : arr) s += v;
16+
return s;
17+
}
18+
19+
// Another example: average of doubles
20+
public static double average(double[] arr) {
21+
if (arr.length == 0) return 0.0;
22+
double s = 0;
23+
for (double v : arr) s += v;
24+
return s / arr.length;
25+
}
26+
27+
// main stays interactive for manual testing (optional)
28+
public static void main(String[] args) {
29+
Scanner in = new Scanner(System.in);
30+
System.out.println("This is a starter file. Implement methods for unit tests.");
31+
in.close();
32+
}
33+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package challenges;
2+
3+
import org.junit.jupiter.api.Test;
4+
import static org.junit.jupiter.api.Assertions.*;
5+
6+
public class FundamentalsPracticeTest {
7+
8+
@Test
9+
public void testSum() {
10+
int[] a = {1,2,3,4};
11+
assertEquals(10, FundamentalsPractice.sum(a));
12+
}
13+
14+
@Test
15+
public void testAverage() {
16+
double[] a = {2.0, 4.0, 6.0};
17+
assertEquals(4.0, FundamentalsPractice.average(a), 1e-6);
18+
}
19+
}

0 commit comments

Comments
 (0)