Skip to content

Commit 27e82f6

Browse files
committed
Add Java foundations and core checkpoints
1 parent f4f1282 commit 27e82f6

14 files changed

Lines changed: 788 additions & 20 deletions

File tree

CONCEPT_INDEX.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ Use this page to browse the same concept across every active language track.
5858

5959
| Level | C++ | C# | Go | Java | Python | TypeScript |
6060
| --- | --- | --- | --- | --- | --- | --- |
61-
| 01-foundations | [C++](languages/cpp/projects/01-foundations/README.md) | [C#](languages/csharp/projects/01-foundations/README.md) | [Go](languages/go/projects/01-foundations/README.md) | Planned | [Python](languages/python/projects/01-foundations/README.md) | [TypeScript](languages/typescript/projects/01-foundations/README.md) |
62-
| 02-core | [C++](languages/cpp/projects/02-core/README.md) | [C#](languages/csharp/projects/02-core/README.md) | [Go](languages/go/projects/02-core/README.md) | Planned | [Python](languages/python/projects/02-core/README.md) | [TypeScript](languages/typescript/projects/02-core/README.md) |
61+
| 01-foundations | [C++](languages/cpp/projects/01-foundations/README.md) | [C#](languages/csharp/projects/01-foundations/README.md) | [Go](languages/go/projects/01-foundations/README.md) | [Java](languages/java/projects/01-foundations/README.md) | [Python](languages/python/projects/01-foundations/README.md) | [TypeScript](languages/typescript/projects/01-foundations/README.md) |
62+
| 02-core | [C++](languages/cpp/projects/02-core/README.md) | [C#](languages/csharp/projects/02-core/README.md) | [Go](languages/go/projects/02-core/README.md) | [Java](languages/java/projects/02-core/README.md) | [Python](languages/python/projects/02-core/README.md) | [TypeScript](languages/typescript/projects/02-core/README.md) |
6363
| 03-advanced | [C++](languages/cpp/projects/03-advanced/README.md) | [C#](languages/csharp/projects/03-advanced/README.md) | [Go](languages/go/projects/03-advanced/README.md) | Planned | [Python](languages/python/projects/03-advanced/README.md) | [TypeScript](languages/typescript/projects/03-advanced/README.md) |
6464
| 04-expert | [C++](languages/cpp/projects/04-expert/README.md) | [C#](languages/csharp/projects/04-expert/README.md) | [Go](languages/go/projects/04-expert/README.md) | Planned | [Python](languages/python/projects/04-expert/README.md) | [TypeScript](languages/typescript/projects/04-expert/README.md) |
6565

6666
### Assessments
6767

6868
| Level | C++ | C# | Go | Java | Python | TypeScript |
6969
| --- | --- | --- | --- | --- | --- | --- |
70-
| 01-foundations | [C++](languages/cpp/assessments/01-foundations/README.md) | [C#](languages/csharp/assessments/01-foundations/README.md) | [Go](languages/go/assessments/01-foundations/README.md) | Planned | [Python](languages/python/assessments/01-foundations/README.md) | [TypeScript](languages/typescript/assessments/01-foundations/README.md) |
71-
| 02-core | [C++](languages/cpp/assessments/02-core/README.md) | [C#](languages/csharp/assessments/02-core/README.md) | [Go](languages/go/assessments/02-core/README.md) | Planned | [Python](languages/python/assessments/02-core/README.md) | [TypeScript](languages/typescript/assessments/02-core/README.md) |
70+
| 01-foundations | [C++](languages/cpp/assessments/01-foundations/README.md) | [C#](languages/csharp/assessments/01-foundations/README.md) | [Go](languages/go/assessments/01-foundations/README.md) | [Java](languages/java/assessments/01-foundations/README.md) | [Python](languages/python/assessments/01-foundations/README.md) | [TypeScript](languages/typescript/assessments/01-foundations/README.md) |
71+
| 02-core | [C++](languages/cpp/assessments/02-core/README.md) | [C#](languages/csharp/assessments/02-core/README.md) | [Go](languages/go/assessments/02-core/README.md) | [Java](languages/java/assessments/02-core/README.md) | [Python](languages/python/assessments/02-core/README.md) | [TypeScript](languages/typescript/assessments/02-core/README.md) |
7272
| 03-advanced | [C++](languages/cpp/assessments/03-advanced/README.md) | [C#](languages/csharp/assessments/03-advanced/README.md) | [Go](languages/go/assessments/03-advanced/README.md) | Planned | [Python](languages/python/assessments/03-advanced/README.md) | [TypeScript](languages/typescript/assessments/03-advanced/README.md) |
7373
| 04-expert | [C++](languages/cpp/assessments/04-expert/README.md) | [C#](languages/csharp/assessments/04-expert/README.md) | [Go](languages/go/assessments/04-expert/README.md) | Planned | [Python](languages/python/assessments/04-expert/README.md) | [TypeScript](languages/typescript/assessments/04-expert/README.md) |

LANGUAGE_PARITY_MATRIX.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ Status labels:
8484

8585
| Checkpoint | C++ | C# | Go | Java | Python | TypeScript |
8686
| --- | --- | --- | --- | --- | --- | --- |
87-
| 01-foundations | Done | Done | Done | Planned | Done | Done |
88-
| 02-core | Done | Done | Done | Planned | Done | Done |
87+
| 01-foundations | Done | Done | Done | Done | Done | Done |
88+
| 02-core | Done | Done | Done | Done | Done | Done |
8989
| 03-advanced | Done | Done | Done | Planned | Done | Done |
9090
| 04-expert | Done | Done | Done | Planned | Done | Done |
9191

9292
### Assessments
9393

9494
| Checkpoint | C++ | C# | Go | Java | Python | TypeScript |
9595
| --- | --- | --- | --- | --- | --- | --- |
96-
| 01-foundations | Done | Done | Done | Planned | Done | Done |
97-
| 02-core | Done | Done | Done | Planned | Done | Done |
96+
| 01-foundations | Done | Done | Done | Done | Done | Done |
97+
| 02-core | Done | Done | Done | Done | Done | Done |
9898
| 03-advanced | Done | Done | Done | Planned | Done | Done |
9999
| 04-expert | Done | Done | Done | Planned | Done | Done |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ If you only want to learn one track, follow that track README first because lang
5656
| C++ | 00-setup, 01-foundations, 02-core, 03-advanced, 04-expert | Foundations, Core, Advanced, Expert, projects, assessments | Most complete and primary track |
5757
| C# | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
5858
| Go | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
59-
| Java | 01-foundations, 02-core | 8/8 foundations modules, 6/6 core modules | Java 21 MVP; advanced, expert, projects, and assessments planned |
59+
| Java | 01-foundations, 02-core | 8/8 foundations modules, 6/6 core modules, 2/4 projects, 2/4 assessments | Java 21 MVP through core; advanced, expert, and later checkpoints planned |
6060
| Python | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
6161
| TypeScript | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
6262

languages/java/CHECKLIST.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,18 @@
3434
- [ ] error-handling-and-defensive-programming example
3535
- [ ] error-handling-and-defensive-programming exercises
3636

37+
## Checkpoints
38+
39+
- [ ] projects/01-foundations
40+
- [ ] projects/02-core
41+
- [ ] assessments/01-foundations
42+
- [ ] assessments/02-core
43+
3744
## Planned
3845

3946
- [ ] 03-advanced modules
4047
- [ ] 04-expert modules
41-
- [ ] projects
42-
- [ ] assessments
48+
- [ ] projects/03-advanced
49+
- [ ] projects/04-expert
50+
- [ ] assessments/03-advanced
51+
- [ ] assessments/04-expert

languages/java/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Scope and Status
44

5-
This track currently covers `01-foundations` and `02-core` as a Java 21 MVP. Advanced, expert, projects, and assessments are planned for later iterations.
5+
This track currently covers `01-foundations` and `02-core` as a Java 21 MVP, including projects and assessments for both implemented levels. Advanced, expert, and later checkpoints are planned for future iterations.
66

77
- 8/8 foundations modules implemented.
88
- 6/6 core modules implemented.
99
- 0/5 advanced modules implemented.
1010
- 0/5 expert modules implemented.
11-
- 0/4 projects implemented.
12-
- 0/4 assessments implemented.
11+
- 2/4 projects implemented (`01-foundations`, `02-core`).
12+
- 2/4 assessments implemented (`01-foundations`, `02-core`).
1313
- Uses Java 21 LTS with direct `javac` and `java` commands; no Maven or Gradle yet.
1414

1515
## Prerequisites
@@ -49,6 +49,12 @@ java -cp build/java Main
4949
- [sorting-and-searching](./02-core/sorting-and-searching/README.md)
5050
- [maps-and-frequency-counting](./02-core/maps-and-frequency-counting/README.md)
5151
- [error-handling-and-defensive-programming](./02-core/error-handling-and-defensive-programming/README.md)
52+
- Projects
53+
- [01-foundations](./projects/01-foundations/README.md)
54+
- [02-core](./projects/02-core/README.md)
55+
- Assessments
56+
- [01-foundations](./assessments/01-foundations/README.md)
57+
- [02-core](./assessments/02-core/README.md)
5258

5359
## Progress Tracking
5460

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import java.util.ArrayList;
2+
import java.util.List;
3+
import java.util.Locale;
4+
import java.util.Scanner;
5+
6+
public class Main {
7+
record Student(String name, int score) {
8+
}
9+
10+
static int readPositiveCount(Scanner scanner) {
11+
while (true) {
12+
System.out.print("How many students? ");
13+
String raw = scanner.nextLine().trim();
14+
try {
15+
int value = Integer.parseInt(raw);
16+
if (value > 0) {
17+
return value;
18+
}
19+
System.out.println("Please enter a number greater than zero.");
20+
} catch (NumberFormatException error) {
21+
System.out.println("Please enter a valid integer.");
22+
}
23+
}
24+
}
25+
26+
static String readNonEmpty(Scanner scanner, String prompt) {
27+
while (true) {
28+
System.out.print(prompt);
29+
String value = scanner.nextLine().trim();
30+
if (!value.isEmpty()) {
31+
return value;
32+
}
33+
System.out.println("This value cannot be empty.");
34+
}
35+
}
36+
37+
static int readScore(Scanner scanner, String prompt) {
38+
while (true) {
39+
System.out.print(prompt);
40+
String raw = scanner.nextLine().trim();
41+
try {
42+
int score = Integer.parseInt(raw);
43+
if (score >= 0 && score <= 100) {
44+
return score;
45+
}
46+
System.out.println("Score must be between 0 and 100.");
47+
} catch (NumberFormatException error) {
48+
System.out.println("Please enter a valid integer score.");
49+
}
50+
}
51+
}
52+
53+
public static void main(String[] args) {
54+
Locale.setDefault(Locale.US);
55+
Scanner scanner = new Scanner(System.in);
56+
List<Student> students = new ArrayList<>();
57+
int count = readPositiveCount(scanner);
58+
59+
for (int index = 1; index <= count; index++) {
60+
String name = readNonEmpty(scanner, "Student #" + index + " name: ");
61+
int score = readScore(scanner, name + "'s score (0-100): ");
62+
students.add(new Student(name, score));
63+
}
64+
65+
int total = 0;
66+
Student highest = students.get(0);
67+
Student lowest = students.get(0);
68+
int passed = 0;
69+
70+
System.out.println("Students:");
71+
for (Student student : students) {
72+
System.out.println("- " + student.name() + ": " + student.score());
73+
total += student.score();
74+
if (student.score() > highest.score()) {
75+
highest = student;
76+
}
77+
if (student.score() < lowest.score()) {
78+
lowest = student;
79+
}
80+
if (student.score() >= 60) {
81+
passed++;
82+
}
83+
}
84+
85+
System.out.printf("Average: %.2f%n", (double) total / students.size());
86+
System.out.println("Highest: " + highest.name() + " (" + highest.score() + ")");
87+
System.out.println("Lowest: " + lowest.name() + " (" + lowest.score() + ")");
88+
System.out.println("Passed: " + passed + "/" + students.size());
89+
}
90+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Assessment 01: Foundations
2+
3+
## Goal
4+
5+
Build confidence with input handling, loops, methods, lists, and strings.
6+
7+
## Task
8+
9+
Write a program that:
10+
11+
1. Reads an integer `N` (`N > 0`).
12+
2. Reads `N` full names and exam scores (`0..100`).
13+
3. Prints:
14+
- all records
15+
- average score
16+
- highest score with student name
17+
- lowest score with student name
18+
- pass count (`score >= 60`)
19+
20+
## Learning Metadata
21+
22+
- Difficulty: Beginner.
23+
- Estimated Time: 30-45 minutes.
24+
- Prerequisites: All `01-foundations` modules, especially `types-and-io`, `control-flow`, and `strings`.
25+
- Learning Focus: Prove you can read structured input, preserve names, and compute accurate summaries without step-by-step scaffolding.
26+
27+
## Quick Run
28+
29+
```bash
30+
javac -d build/java languages/java/assessments/01-foundations/Main.java
31+
java -cp build/java Main
32+
```
33+
34+
## Sample Input
35+
36+
```text
37+
3
38+
Ana Smith
39+
91
40+
Bob Lee
41+
55
42+
Carla Mendez
43+
88
44+
```
45+
46+
## Sample Output (shape)
47+
48+
```text
49+
Students:
50+
- Ana Smith: 91
51+
- Bob Lee: 55
52+
- Carla Mendez: 88
53+
Average: 78.00
54+
Highest: Ana Smith (91)
55+
Lowest: Bob Lee (55)
56+
Passed: 2/3
57+
```
58+
59+
## Cross-Language Notes
60+
61+
- Compared with C++, Java keeps the assessment strongly typed with less setup code.
62+
- Relative to Python and TypeScript, Java's explicit record type makes the stored data shape visible.
63+
- The comparison to watch is how much structure is useful before introducing packages and projects.
64+
65+
## What To Check
66+
67+
- full names are preserved exactly as entered
68+
- highest and lowest records match the actual dataset
69+
- pass counts and averages use the required scoring rules
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import java.io.IOException;
2+
import java.nio.file.Files;
3+
import java.nio.file.Path;
4+
import java.util.ArrayList;
5+
import java.util.List;
6+
import java.util.Locale;
7+
import java.util.Scanner;
8+
9+
public class Main {
10+
static String bucketLabel(int start) {
11+
int end = start == 90 ? 100 : start + 9;
12+
return start + "-" + end;
13+
}
14+
15+
static int bucketCount(List<Integer> scores, int start) {
16+
int end = start == 90 ? 100 : start + 9;
17+
int count = 0;
18+
for (int score : scores) {
19+
if (score >= start && score <= end) {
20+
count++;
21+
}
22+
}
23+
return count;
24+
}
25+
26+
public static void main(String[] args) throws IOException {
27+
Locale.setDefault(Locale.US);
28+
Scanner scanner = new Scanner(System.in);
29+
List<Integer> scores = new ArrayList<>();
30+
31+
while (true) {
32+
System.out.print("Enter a score (0-100) or -1 to finish: ");
33+
if (!scanner.hasNext()) {
34+
break;
35+
}
36+
37+
String raw = scanner.next().trim();
38+
int value;
39+
try {
40+
value = Integer.parseInt(raw);
41+
} catch (NumberFormatException error) {
42+
System.out.println("Invalid integer. Try again.");
43+
continue;
44+
}
45+
46+
if (value == -1) {
47+
break;
48+
}
49+
if (value < 0 || value > 100) {
50+
System.out.println("Score ignored because it is outside 0-100.");
51+
continue;
52+
}
53+
scores.add(value);
54+
}
55+
56+
List<String> lines = new ArrayList<>();
57+
lines.add("Valid scores: " + scores.size());
58+
59+
if (scores.isEmpty()) {
60+
lines.add("Average: N/A");
61+
lines.add("Minimum: N/A");
62+
lines.add("Maximum: N/A");
63+
} else {
64+
int total = 0;
65+
int minimum = scores.get(0);
66+
int maximum = scores.get(0);
67+
for (int score : scores) {
68+
total += score;
69+
minimum = Math.min(minimum, score);
70+
maximum = Math.max(maximum, score);
71+
}
72+
lines.add(String.format("Average: %.2f", (double) total / scores.size()));
73+
lines.add("Minimum: " + minimum);
74+
lines.add("Maximum: " + maximum);
75+
}
76+
77+
lines.add("Frequency:");
78+
for (int start = 0; start < 100; start += 10) {
79+
lines.add("- " + bucketLabel(start) + ": " + bucketCount(scores, start));
80+
}
81+
82+
for (String line : lines) {
83+
System.out.println(line);
84+
}
85+
86+
Path reportPath = Path.of("core_assessment_report.txt");
87+
Files.write(reportPath, lines);
88+
System.out.println("Report written to core_assessment_report.txt");
89+
}
90+
}

0 commit comments

Comments
 (0)