From ae9da2f7f0ce0a5b73d12a3c8bd7018e82f973f6 Mon Sep 17 00:00:00 2001 From: RandyCastr0 <160950862+RandyCastr0@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:34:19 -0500 Subject: [PATCH] feat: adds Randy's quiz (#124) * chore: made quiz folder under quizzes * added 2 questions * chore: updated questions and added an * added another question * chore: added answers * chore: deleted 1 question * chore: updated question and answers * chore: fixed answers * deleted file * update * update * update * undo files * delete settings file --- .../lesson3/quizzes/RandycastroQuiz.java | 45 +++++++++++++++++++ .../src/test/resources/application.yml | 5 ++- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 lesson_03/quiz/lesson_03_quiz/src/main/java/com/codedifferently/lesson3/quizzes/RandycastroQuiz.java diff --git a/lesson_03/quiz/lesson_03_quiz/src/main/java/com/codedifferently/lesson3/quizzes/RandycastroQuiz.java b/lesson_03/quiz/lesson_03_quiz/src/main/java/com/codedifferently/lesson3/quizzes/RandycastroQuiz.java new file mode 100644 index 00000000..f36b985d --- /dev/null +++ b/lesson_03/quiz/lesson_03_quiz/src/main/java/com/codedifferently/lesson3/quizzes/RandycastroQuiz.java @@ -0,0 +1,45 @@ +package com.codedifferently.lesson3.quizzes; + +import com.codedifferently.instructional.quiz.AnswerChoice; +import com.codedifferently.instructional.quiz.MultipleChoiceQuizQuestion; +import com.codedifferently.instructional.quiz.QuizQuestion; +import com.codedifferently.instructional.quiz.QuizQuestionProvider; +import java.util.List; +import java.util.Map; +import org.springframework.stereotype.Service; + +@Service +public class RandycastroQuiz implements QuizQuestionProvider { + + public String getProviderName() { + return "randycastro"; + } + + public List makeQuizQuestions() { + return List.of(makeQuestion0(), makeQuestion1()); + } + + private QuizQuestion makeQuestion0() { + return new MultipleChoiceQuizQuestion( + 0, + "What does CPU stand for?", + Map.of( + AnswerChoice.A, "Central Processing Unit", + AnswerChoice.B, "Computer Power Unit", + AnswerChoice.C, "Control Processing Unit", + AnswerChoice.D, "Central Power Unit"), + AnswerChoice.A); // Replace `UNANSWERED` with the correct answer. + } + + private QuizQuestion makeQuestion1() { + return new MultipleChoiceQuizQuestion( + 1, + "Which of the following is a type of computer memory that is volatile and loses its contents when the power is turned off?", + Map.of( + AnswerChoice.A, "ROM (Read-Only Memory)", + AnswerChoice.B, "RAM (Random Access Memory)", + AnswerChoice.C, "HDD (Hard Disk Drive)", + AnswerChoice.D, "SSD (Solid State Drive)"), + AnswerChoice.D); // Replace 'UNANSWERED' with the correct answer. + } +} diff --git a/lesson_03/quiz/lesson_03_quiz/src/test/resources/application.yml b/lesson_03/quiz/lesson_03_quiz/src/test/resources/application.yml index ba8eaabe..499cfe37 100644 --- a/lesson_03/quiz/lesson_03_quiz/src/test/resources/application.yml +++ b/lesson_03/quiz/lesson_03_quiz/src/test/resources/application.yml @@ -36,5 +36,6 @@ quiz: vicentevigueras: - $2y$10$ZvHv8epqQTKiHglU62V5YOAT0gMAgzkikkabDH56gY3oqeFpK0uKC - $2y$10$VIQxIQCzXdOYgiYfJ62.luYL5DFu34tU0HbqlawoH2LAOYCbT.Bky - - + randycastro: + - $2y$10$JDR92zWPkVIhw5.ipD3Tye6rJctiwGiNDL/QV1bZBY9OqH569SUmG + - $2y$10$Bc8KTSlblvafPd3Jskm4l.g1CAEgG4k5m/LPa99D3U3uHXwiLF1.e \ No newline at end of file