Skip to content

Commit 7719d8e

Browse files
committed
feat:tried to get it working
1 parent cbda24d commit 7719d8e

File tree

5 files changed

+54
-38
lines changed

5 files changed

+54
-38
lines changed

lesson_02/quiz-java/app/build.gradle

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
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/9.0.0/userguide/building_java_projects.html in the Gradle documentation.
6-
*/
7-
81
plugins {
92
// Apply the application plugin to add support for building a CLI application in Java.
103
id 'application'
@@ -16,12 +9,8 @@ repositories {
169
}
1710

1811
dependencies {
19-
// Use JUnit Jupiter for testing.
20-
testImplementation libs.junit.jupiter
21-
12+
testImplementation libs.junit_jupiter
2213
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
23-
24-
// This dependency is used by the application.
2514
implementation libs.guava
2615
implementation project(":codedifferently-instructional")
2716
}
@@ -42,5 +31,3 @@ tasks.named('test') {
4231
// Use JUnit Platform for unit tests.
4332
useJUnitPlatform()
4433
}
45-
46-

lesson_02/quiz-java/app/src/main/java/org/example/Lesson.java

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,32 @@
77
import java.util.Map;
88

99
import com.codedifferently.instructional.quiz.MultipleChoiceQuizQuestion;
10-
import com.sun.org.apache.xpath.internal.operations.Mult;
11-
10+
import com.codedifferently.instructional.quiz.MultipleChoiceQuestion;
1211
public class Lesson {
12+
13+
public static void main(String[] args) {
14+
MultipleChoiceQuestion[] questions = makeQuestions();
15+
for(MultipleChoiceQuestion q : questions) {
16+
System.out.println(q);
17+
}
18+
}
19+
20+
public static MultipleChoiceQuestion[] makeQuestions() {
21+
MultipleChoiceQuestion[] questions = new MultipleChoiceQuestion[11];
22+
questions[0] = makeQuestion0();
23+
questions[1] = makeQuestion1();
24+
questions[2] = makeQuestion2();
25+
questions[3] = makeQuestion3();
26+
questions[4] = makeQuestion4();
27+
questions[5] = makeQuestion5();
28+
questions[6] = makeQuestion6();
29+
questions[7] = makeQuestion7();
30+
questions[8] = makeQuestion8();
31+
questions[9] = makeQuestion9();
32+
questions[10] = makeQuestion10();
33+
34+
return questions;
35+
}
1336

1437

1538

@@ -19,6 +42,7 @@ public static MultipleChoiceQuestion makeQuestion0() {
1942
answerChoices.put(AnswerChoice.B, "To keep a record of changes over time");
2043
answerChoices.put(AnswerChoice.C, " To delete unnecessary files");
2144
answerChoices.put(AnswerChoice.D, "To run code more efficiently");
45+
2246
return new MultipleChoiceQuizQuestion(
2347
0,"What is the main purpose of version control?",answerChoices,AnswerChoice.B);
2448
}
@@ -29,6 +53,7 @@ public static MultipleChoiceQuestion makeQuestion1() {
2953
answerChoices.put(AnswerChoice.B, "A temporary backup of the code");
3054
answerChoices.put(AnswerChoice.C, "A tool for merging branches");
3155
answerChoices.put(AnswerChoice.D, "What is a fork in Git?");
56+
3257
return new MultipleChoiceQuizQuestion(
3358
1,"What is the main purpose of version control?",answerChoices,AnswerChoice.B);
3459
}
@@ -39,6 +64,7 @@ public static MultipleChoiceQuizQuestion makeQuestion2() {
3964
answerChoices.put(AnswerChoice.B, "Commit changes locally");
4065
answerChoices.put(AnswerChoice.C, "Push changes to the server");
4166
answerChoices.put(AnswerChoice.D, "Write code directly in GitHub");
67+
4268
return new MultipleChoiceQuizQuestion(
4369
2,"Which of the following is NOT part of the basic Git workflow?",answerChoices,AnswerChoice.D);
4470
}
@@ -48,6 +74,7 @@ public static MultipleChoiceQuizQuestion makeQuestion3() {
4874
answerChoices.put(AnswerChoice.B, "git merge");
4975
answerChoices.put(AnswerChoice.C, "git branch");
5076
answerChoices.put(AnswerChoice.D, "git pull");
77+
5178
return new MultipleChoiceQuizQuestion(
5279
3,"What command is used to combine changes from different branches?",answerChoices,AnswerChoice.B);
5380
}
@@ -58,6 +85,7 @@ public static MultipleChoiceQuizQuestion makeQuestion4() {
5885
answerChoices.put(AnswerChoice.B, "IntelliJ IDEA");
5986
answerChoices.put(AnswerChoice.C, "NetBeans");
6087
answerChoices.put(AnswerChoice.D, "VS Code");
88+
6189
return new MultipleChoiceQuizQuestion(
6290
4,"Which IDE is being used in the class?",answerChoices,AnswerChoice.D);
6391
}
@@ -68,10 +96,11 @@ public static MultipleChoiceQuizQuestion makeQuestion5() {
6896
answerChoices.put(AnswerChoice.B, "Debugger");
6997
answerChoices.put(AnswerChoice.C, "Dev Containers");
7098
answerChoices.put(AnswerChoice.D, "Source Control");
99+
71100
return new MultipleChoiceQuizQuestion(
72101
5,"What feature allows developers to work from the same pre-configured environment in VS Code?",answerChoices,AnswerChoice.C);
73102
}
74-
static makeQuestion6() {
103+
public static MultipleChoiceQuizQuestion makeQuestion6() {
75104
Map<AnswerChoice, String> answerChoices = new HashMap<>();
76105
answerChoices.put(AnswerChoice.A, "Editing and refactoring code");
77106
answerChoices.put(AnswerChoice.B, "Browsing code");
@@ -82,42 +111,44 @@ static makeQuestion6() {
82111
return new MultipleChoiceQuizQuestion(
83112
6,"What is NOT a reason for using an IDE?",answerChoices,AnswerChoice.C);
84113
}
85-
static makeQuestion7() {
114+
public static MultipleChoiceQuizQuestion makeQuestion7() {
86115
Map<AnswerChoice, String> answerChoices = new HashMap<>();
87116
answerChoices.put(AnswerChoice.A, "pwd");
88117
answerChoices.put(AnswerChoice.B, "ls");
89118
answerChoices.put(AnswerChoice.C, "cd");
90119
answerChoices.put(AnswerChoice.D, "mkdir");
120+
91121
return new MultipleChoiceQuizQuestion(
92122
7,"Which command is used to print the current working directory in the terminal?",answerChoices,AnswerChoice.A);
93123
}
94-
static makeQuestion8() {
124+
public static MultipleChoiceQuizQuestion makeQuestion8() {
95125
Map<AnswerChoice, String> answerChoices = new HashMap<>();
96126
answerChoices.put(AnswerChoice.A, "pwd");
97127
answerChoices.put(AnswerChoice.B, "ls");
98128
answerChoices.put(AnswerChoice.C, "cd");
99129
answerChoices.put(AnswerChoice.D, "mkdir");
130+
100131
return new MultipleChoiceQuizQuestion(
101132
8,"Which command is used to change directories in the terminal?",answerChoices,AnswerChoice.C);
102133
}
103-
static makeQuestion9() {
134+
public static MultipleChoiceQuizQuestion makeQuestion9() {
104135

105136
Map<AnswerChoice, String> answerChoices = new HashMap<>();
106137
answerChoices.put(AnswerChoice.A, "Change file or directory permissions");
107138
answerChoices.put(AnswerChoice.B, "List files in a directory");
108139
answerChoices.put(AnswerChoice.C, "Remove a file or directory");
109140
answerChoices.put(AnswerChoice.D, "Copy a file or directory");
141+
110142
return new MultipleChoiceQuizQuestion(
111143
9,"What does the command `chmod` do?",answerChoices,AnswerChoice.A);
112144

113145
}
114-
static makeQuestion10() {
115-
146+
public static MultipleChoiceQuizQuestion makeQuestion10() {
116147
Map<AnswerChoice, String> answerChoices = new HashMap<>();
117148
answerChoices.put(AnswerChoice.A, "⌘ + Shift + T");
118-
answerChoices.put(AnswerChoice.B, '⌘ + Spacebar, then type "terminal"');
149+
answerChoices.put(AnswerChoice.B, "⌘ + Spacebar, then type terminal");
119150
answerChoices.put(AnswerChoice.C, "⌘ + Q");
120-
answerChoices.put(AnswerChoice.D, '⌘ + S, then type "terminal"');
151+
answerChoices.put(AnswerChoice.D, "⌘ + S, then type terminal");
121152

122153

123154
return new MultipleChoiceQuizQuestion(

lesson_02/quiz-java/app/src/main/resources/application.yml

Whitespace-only changes.
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# This file was generated by the Gradle 'init' task.
2-
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3-
41
[versions]
52
guava = "33.4.6-jre"
63
junit-jupiter = "5.12.1"
74

85
[libraries]
96
guava = { module = "com.google.guava:guava", version.ref = "guava" }
10-
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
7+
junit_jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
/*
2-
* This file was generated by the Gradle 'init' task.
3-
*
4-
* The settings file is used to specify which projects to include in your build.
5-
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.0.0/userguide/multi_project_builds.html in the Gradle documentation.
6-
*/
7-
81
plugins {
92
// Apply the foojay-resolver plugin to allow automatic download of JDKs
103
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
114
}
125

13-
rootProject.name = 'quiz-java'
6+
dependencyResolutionManagement {
7+
versionCatalogs {
8+
libs {
9+
from(files("gradle/libs.versions.toml"))
10+
}
11+
}
12+
}
1413

15-
include("app", ":codedifferently-instructional")
14+
rootProject.name = 'codedifferently-instructional'
1615

17-
project(":codedifferently-instructional").projectDir = file("../../lib/java/codedifferently-instructional/instructional-lib")
16+
17+
include("app", ":codedifferently-instructional")
18+
project(":codedifferently-instructional").projectDir = file("../../lib/java/codedifferently-instructional/instructional-lib")

0 commit comments

Comments
 (0)