1
+ const input = require ( 'readline-sync' ) ;
2
+
3
+
4
+ // TODO 2: modify your quiz app to ask 5 questions //
5
+
6
+ // TODO 1.1a: Define candidateName //
7
+ let candidateName = "" ;
8
+
9
+
10
+ // TODO 1.2a: Define question, correctAnswer, and candidateAnswer //
11
+ let question = "" ;
12
+ let correctAnswer = "" ;
13
+ let candidateAnswer = "" ;
14
+
15
+
16
+ //TODO: Variables for Part 2
17
+ let questions = "" ;
18
+ let correctAnswers = "Sally Ride" ;
19
+ let candidateAnswers = "" ;
20
+
21
+
22
+ function askForName ( ) { }
23
+ //just some comments
24
+ // TODO 1.1b: Ask for candidate's name //
25
+ candidateName = input . question ( "what is your name? " ) ;
26
+ console . log ( "Hello are you ready for a space quiz: " + candidateName )
27
+ function askQuestion ( ) { }
28
+ // TODO 1.2b: Ask candidate the question and assign the response as candidateAnswer // }
29
+ candidateAnswers = input . question ( "Who was the first woman in space? " ) ;
30
+
31
+ function gradeQuiz ( candidateAnswers ) { }
32
+ if ( candidateAnswers === correctAnswers ) {
33
+ console . log ( "Heck yeah! you got it correct" ) ;
34
+ } else {
35
+ console . log ( "Sorry that answer is incorrect" ) ;
36
+ }
37
+ // TODO 1.2c: Let the candidate know if they have answered the question correctly or incorrectly //
38
+ //just an update
39
+
40
+
41
+ let grade ; //TODO 3.2 use this variable to calculate the candidates score.
42
+
43
+
44
+ return grade ;
45
+
46
+ function runProgram ( ) {
47
+ askForName ( ) ;
48
+
49
+ // TODO 1.1c: Greet candidate using their name //
50
+ console . log ( "Hello: " + candidateName ) ;
51
+ askQuestion ( ) ;
52
+ gradeQuiz ( this . candidateAnswers ) ;
53
+ }
54
+ //console.log("Hello : " + " " + candidateName);
55
+ // ----------- Don't write any code or change any code below this line ---------- //
56
+ module . exports = {
57
+ candidateName : candidateName ,
58
+ question : question ,
59
+ correctAnswer : correctAnswer ,
60
+ candidateAnswer : candidateAnswer ,
61
+ questions : questions ,
62
+ correctAnswers : correctAnswers ,
63
+ candidateAnswers : candidateAnswers ,
64
+ gradeQuiz : gradeQuiz ,
65
+ runProgram : runProgram
66
+ } ;
0 commit comments