-
Notifications
You must be signed in to change notification settings - Fork 29
Danielson Adjocy Feature/lesson 02 + stretch #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9eb6e4e
Added files
080667e
update
a97238e
update
d744235
update
cb68f78
update
5365174
update
33ac6e1
update
98336a7
update
651807f
”update”
DaFDE31 c1a0491
finished README
DaFDE31 2ac0d00
fix:fixing chhange requests
c63cfb7
feat: add work email
a48373f
Merge pull request #1 from DaFDE31/feature/no-ref/personal-readme
DaFDE31 15daaa9
Merge branch 'code-differently:main' into main
DaFDE31 e17ae60
Merge branch 'code-differently:main' into main
DaFDE31 3c89d60
Merge branch 'code-differently:main' into main
DaFDE31 fa32d54
Merge branch 'code-differently:main' into main
DaFDE31 0f4041f
feat:quiz finished
DaFDE31 c12548c
feat:stretch started but with errors
DaFDE31 262b4cf
feat:config
DaFDE31 ca0f14c
chore:update
DaFDE31 f75abf0
feat: imports working; some classes not working
DaFDE31 0c37c36
feat: theoretically working
DaFDE31 c34569e
fix: version discrepency dealt with; code fixed
DaFDE31 7944d81
fix: Rename lesson2.java to Lesson2.java
DaFDE31 76b9d5d
fix: Rename lesson2test.java to Lesson2test.java
DaFDE31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
||
# Binary files should be left untouched | ||
*.jar binary | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Java application project to get you started. | ||
* 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. | ||
*/ | ||
|
||
plugins { | ||
java | ||
id("org.springframework.boot") version "3.1.0" | ||
id("io.spring.dependency-management") version "1.1.0" | ||
application | ||
} | ||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
flatDir { | ||
dirs("../../../lib/java/codedifferently-instructional") | ||
} | ||
} | ||
|
||
|
||
// Instead of this (which doesn't work): | ||
// implementation("com.codedifferently.instructional:instructional-lib") | ||
|
||
// Use direct file reference: | ||
dependencies { | ||
implementation("org.apache.commons:commons-text:1.10.0") | ||
implementation(project(":instructional-lib")) | ||
implementation("org.springframework.boot:spring-boot-starter") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
|
||
|
||
} | ||
|
||
// Apply a specific Java toolchain to ease working on different environments. | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(22) | ||
} | ||
} | ||
|
||
application { | ||
// Define the main class for the application. | ||
mainClass.set("org.example.Lesson2") | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} |
204 changes: 204 additions & 0 deletions
204
lesson_02/quiz_java/app/src/main/java/org/example/Lesson2.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
package org.example; | ||
|
||
import java.util.* ; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
import com.codedifferently.instructional.quiz.AnswerChoice; | ||
import com.codedifferently.instructional.quiz.MultipleChoiceQuizQuestion; | ||
import com.codedifferently.instructional.quiz.QuizPrinter; | ||
import com.codedifferently.instructional.quiz.QuizQuestion; | ||
|
||
@SpringBootApplication | ||
public class Lesson2 { | ||
|
||
public static ArrayList<QuizQuestion> makeQuizQuestions() { | ||
ArrayList<QuizQuestion> quizQuestions = new ArrayList<>(); | ||
quizQuestions.add(Lesson2.makeQuestion0()); | ||
quizQuestions.add(Lesson2.makeQuestion1()); | ||
quizQuestions.add(Lesson2.makeQuestion2()); | ||
quizQuestions.add(Lesson2.makeQuestion3()); | ||
quizQuestions.add(Lesson2.makeQuestion4()); | ||
quizQuestions.add(Lesson2.makeQuestion5()); | ||
quizQuestions.add(Lesson2.makeQuestion6()); | ||
quizQuestions.add(Lesson2.makeQuestion7()); | ||
quizQuestions.add(Lesson2.makeQuestion8()); | ||
quizQuestions.add(Lesson2.makeQuestion9()); | ||
quizQuestions.add(Lesson2.makeQuestion10()); | ||
return quizQuestions; | ||
} | ||
|
||
public static void main(String[] args) { | ||
ArrayList<QuizQuestion> quizQuestions = Lesson2.makeQuizQuestions(); | ||
if (quizQuestions == null || quizQuestions.isEmpty()) { | ||
throw new Error("Quiz questions cannot be null or empty"); | ||
} | ||
final QuizPrinter printer = new QuizPrinter(); | ||
printer.printQuiz(quizQuestions); | ||
} | ||
|
||
private static QuizQuestion makeQuestion0(){ | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "To make backups of files"); | ||
answers.put(AnswerChoice.B, "To keep a record of changes over time"); | ||
answers.put(AnswerChoice.C, "To delete unnecessary files"); | ||
answers.put(AnswerChoice.D, "To run code more efficiently"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
0, | ||
"What is the main purpose of version control?", | ||
answers, | ||
AnswerChoice.B); | ||
} | ||
|
||
private static QuizQuestion makeQuestion1() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "A duplicate copy of a repository that you own and modify"); | ||
answers.put(AnswerChoice.B, "A temporary backup of the code"); | ||
answers.put(AnswerChoice.C, "A tool for merging branches"); | ||
answers.put(AnswerChoice.D, "A way to delete a repository"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
1, | ||
"What is a fork in Git?", | ||
answers, | ||
AnswerChoice.A | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion2() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "Pull the latest changes"); | ||
answers.put(AnswerChoice.B, "Commit changes locally"); | ||
answers.put(AnswerChoice.C, "Push changes to the server"); | ||
answers.put(AnswerChoice.D, "Write code directly in GitHub"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
2, | ||
"Which of the following is NOT part of the basic Git workflow?", | ||
answers, | ||
AnswerChoice.D | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion3() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "git commit"); | ||
answers.put(AnswerChoice.B, "git merge"); | ||
answers.put(AnswerChoice.C, "git branch"); | ||
answers.put(AnswerChoice.D, "git pull"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
3, | ||
"What command is used to combine changes from different branches?", | ||
answers, | ||
AnswerChoice.B | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion4() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "Eclipse"); | ||
answers.put(AnswerChoice.B, "IntelliJ IDEA"); | ||
answers.put(AnswerChoice.C, "NetBeans"); | ||
answers.put(AnswerChoice.D, "VS Code"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
4, | ||
"Which IDE is being used in the class?", | ||
answers, | ||
AnswerChoice.D | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion5() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "Extensions"); | ||
answers.put(AnswerChoice.B, "Debugger"); | ||
answers.put(AnswerChoice.C, "Dev Containers"); | ||
answers.put(AnswerChoice.D, "Source Control"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
5, | ||
"What feature allows developers to work from the same pre-configured environment in VS Code?", | ||
answers, | ||
AnswerChoice.C | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion6() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "Editing and refactoring code"); | ||
answers.put(AnswerChoice.B, "Browsing code"); | ||
answers.put(AnswerChoice.C, "Playing music"); | ||
answers.put(AnswerChoice.D, "Managing source control"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
6, | ||
"What is NOT a reason for using an IDE?", | ||
answers, | ||
AnswerChoice.C | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion7() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "pwd"); | ||
answers.put(AnswerChoice.B, "ls"); | ||
answers.put(AnswerChoice.C, "cd"); | ||
answers.put(AnswerChoice.D, "mkdir"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
7, | ||
"What is the command to list files in the current directory?", | ||
answers, | ||
AnswerChoice.B | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion8() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "pwd"); | ||
answers.put(AnswerChoice.B, "ls"); | ||
answers.put(AnswerChoice.C, "cd"); | ||
answers.put(AnswerChoice.D, "mkdir"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
8, | ||
"Which command is used to change directories in the terminal?", | ||
answers, | ||
AnswerChoice.C | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion9() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "Change file or directory permissions"); | ||
answers.put(AnswerChoice.B, "List files in a directory"); | ||
answers.put(AnswerChoice.C, "Remove a file or directory"); | ||
answers.put(AnswerChoice.D, "Copy a file or directory"); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
9, | ||
"What does the command `chmod` do?", | ||
answers, | ||
AnswerChoice.A | ||
); | ||
} | ||
|
||
private static QuizQuestion makeQuestion10() { | ||
Map<AnswerChoice, String> answers = new HashMap<>(); | ||
answers.put(AnswerChoice.A, "⌘ + Shift + T"); | ||
answers.put(AnswerChoice.B, "⌘ + Spacebar, then type \"terminal\""); | ||
answers.put(AnswerChoice.C, "⌘ + Q"); | ||
answers.put(AnswerChoice.D, "⌘ + S, then type \"terminal\""); | ||
|
||
return new MultipleChoiceQuizQuestion( | ||
10, | ||
"What is the shortcut for getting to the Mac terminal?", | ||
answers, | ||
AnswerChoice.B | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't have made any changes to this file.