Skip to content

Commit 1b62b52

Browse files
committed
feat: submits evander blue answers for lesson02 quiz and adds java files for lesson_02 stretch hw
1 parent bfaccb6 commit 1b62b52

File tree

15 files changed

+804
-11
lines changed

15 files changed

+804
-11
lines changed

lesson_02/quiz/src/lesson2.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class Lesson2 {
3939
[AnswerChoice.C, "To delete unnecessary files"],
4040
[AnswerChoice.D, "To run code more efficiently"],
4141
]),
42-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
42+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
4343
);
4444
}
4545

@@ -56,7 +56,7 @@ export class Lesson2 {
5656
[AnswerChoice.C, "A tool for merging branches"],
5757
[AnswerChoice.D, "A way to delete a repository"],
5858
]),
59-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
59+
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
6060
);
6161
}
6262

@@ -70,7 +70,7 @@ export class Lesson2 {
7070
[AnswerChoice.C, "Push changes to the server"],
7171
[AnswerChoice.D, "Write code directly in GitHub"],
7272
]),
73-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
73+
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
7474
);
7575
}
7676

@@ -84,7 +84,7 @@ export class Lesson2 {
8484
[AnswerChoice.C, "git branch"],
8585
[AnswerChoice.D, "git pull"],
8686
]),
87-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
87+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
8888
);
8989
}
9090

@@ -98,7 +98,7 @@ export class Lesson2 {
9898
[AnswerChoice.C, "NetBeans"],
9999
[AnswerChoice.D, "VS Code"],
100100
]),
101-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
101+
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
102102
);
103103
}
104104

@@ -112,7 +112,7 @@ export class Lesson2 {
112112
[AnswerChoice.C, "Dev Containers"],
113113
[AnswerChoice.D, "Source Control"],
114114
]),
115-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
115+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
116116
);
117117
}
118118

@@ -126,7 +126,7 @@ export class Lesson2 {
126126
[AnswerChoice.C, "Playing music"],
127127
[AnswerChoice.D, "Managing source control"],
128128
]),
129-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
129+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
130130
);
131131
}
132132

@@ -140,7 +140,7 @@ export class Lesson2 {
140140
[AnswerChoice.C, "cd"],
141141
[AnswerChoice.D, "mkdir"],
142142
]),
143-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
143+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
144144
);
145145
}
146146

@@ -154,7 +154,7 @@ export class Lesson2 {
154154
[AnswerChoice.C, "cd"],
155155
[AnswerChoice.D, "mkdir"],
156156
]),
157-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
157+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
158158
);
159159
}
160160

@@ -168,7 +168,7 @@ export class Lesson2 {
168168
[AnswerChoice.C, "Remove a file or directory"],
169169
[AnswerChoice.D, "Copy a file or directory"],
170170
]),
171-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
171+
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
172172
);
173173
}
174174

@@ -182,7 +182,7 @@ export class Lesson2 {
182182
[AnswerChoice.C, "⌘ + Q"],
183183
[AnswerChoice.D, '⌘ + S, then type "terminal"'],
184184
]),
185-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
185+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
186186
);
187187
}
188188
}

lesson_02/quiz_java/.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

lesson_02/quiz_java/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build

lesson_02/quiz_java/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Lesson 02 Quiz - Java Port
2+
3+
This is a Java port of the Lesson 02 quiz application, originally written in TypeScript. It demonstrates the same quiz functionality using the `codedifferently-instructional` Java library.
4+
5+
## Features
6+
7+
- 11 multiple choice questions covering:
8+
- Version control and Git concepts
9+
- IDE and development environment topics
10+
- Terminal/command line basics
11+
- Mac-specific shortcuts
12+
13+
## Prerequisites
14+
15+
- Java 21 or later
16+
- Gradle (included via wrapper)
17+
18+
## Building and Running
19+
20+
### Build the project
21+
```bash
22+
./gradlew build
23+
```
24+
25+
### Run the quiz
26+
```bash
27+
./gradlew run
28+
```
29+
30+
### Run tests
31+
```bash
32+
./gradlew test
33+
```
34+
35+
## Project Structure
36+
37+
- `app/src/main/java/quiz_java/Lesson2.java` - Main quiz implementation
38+
- `app/src/main/java/quiz_java/App.java` - Application entry point
39+
- `app/src/test/java/quiz_java/Lesson2Test.java` - Unit tests
40+
- `app/build.gradle.kts` - Build configuration
41+
- `settings.gradle.kts` - Multi-project settings
42+
43+
## Dependencies
44+
45+
This project uses the `codedifferently-instructional` library located at `../../lib/java/codedifferently-instructional/instructional-lib` which provides:
46+
47+
- `AnswerChoice` enum for multiple choice options
48+
- `MultipleChoiceQuizQuestion` class for question representation
49+
- `QuizPrinter` class for displaying the quiz
50+
- `QuizQuestion` base class
51+
52+
## Quiz Questions
53+
54+
The Java implementation contains the same 11 questions as the TypeScript version:
55+
56+
1. **Question 0**: Version control purpose → Answer: B (To keep a record of changes over time)
57+
2. **Question 1**: Git fork definition → Answer: A (A duplicate copy of a repository that you own and modify)
58+
3. **Question 2**: Non-Git workflow activity → Answer: D (Write code directly in GitHub)
59+
4. **Question 3**: Branch merging command → Answer: B (git merge)
60+
5. **Question 4**: Class IDE → Answer: D (VS Code)
61+
6. **Question 5**: VS Code environment feature → Answer: C (Dev Containers)
62+
7. **Question 6**: Non-IDE purpose → Answer: C (Playing music)
63+
8. **Question 7**: Directory listing command → Answer: B (ls)
64+
9. **Question 8**: Directory change command → Answer: C (cd)
65+
10. **Question 9**: chmod command purpose → Answer: A (Change file or directory permissions)
66+
11. **Question 10**: Mac terminal shortcut → Answer: B (⌘ + Spacebar, then type "terminal")
67+
68+
## Notes
69+
70+
This Java port maintains the same structure and answers as the original TypeScript quiz while leveraging the Java ecosystem and demonstrating cross-language compatibility.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* This generated file contains a sample Java application project to get you started.
5+
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.8/userguide/building_java_projects.html in the Gradle documentation.
6+
*/
7+
8+
plugins {
9+
// Apply the application plugin to add support for building a CLI application in Java.
10+
application
11+
}
12+
13+
repositories {
14+
// Use Maven Central for resolving dependencies.
15+
mavenCentral()
16+
}
17+
18+
dependencies {
19+
// Use JUnit Jupiter for testing.
20+
testImplementation(libs.junit.jupiter)
21+
22+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
23+
24+
// This dependency is used by the application.
25+
implementation(libs.guava)
26+
27+
// Add the codedifferently-instructional library
28+
implementation(project(":instructional-lib"))
29+
}
30+
31+
// Apply a specific Java toolchain to ease working on different environments.
32+
java {
33+
toolchain {
34+
languageVersion = JavaLanguageVersion.of(21)
35+
}
36+
}
37+
38+
application {
39+
// Define the main class for the application.
40+
mainClass = "quiz_java.App"
41+
}
42+
43+
tasks.named<Test>("test") {
44+
// Use JUnit Platform for unit tests.
45+
useJUnitPlatform()
46+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This source file was generated by the Gradle 'init' task
3+
*/
4+
package quiz_java;
5+
6+
public class App {
7+
public String getGreeting() {
8+
return "Hello World!";
9+
}
10+
11+
public static void main(String[] args) {
12+
// Run the Lesson2 quiz
13+
new Lesson2().run();
14+
}
15+
}

0 commit comments

Comments
 (0)