Skip to content

Commit

Permalink
Candidate Testing Part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
strickte committed May 20, 2024
1 parent fc503ca commit ddd75eb
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions candidate-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@ let candidateAnswer = '';


//TODO: Variables for Part 2
let questions;
let correctAnswers;
let candidateAnswers;
let questions = [
"Who was the first American woman in space? ",
"True or false: 5 kilometer == 5000 meters? ",
'(5 + 3)/2 * 10 = ? ',
"Given the array [8, 'Orbit', 'Trajectory', 45], what entry is at index 2? ",
"What is the minimum crew size for the ISS? "
];
let correctAnswers = [
'Sally Ride',
'true',
'40',
'Trajectory',
'3'
];
let candidateAnswers = [];


function askForName() {
Expand All @@ -25,19 +37,18 @@ function askForName() {

function askQuestion() {
// TODO 1.2b: Ask candidate the question and assign the response as candidateAnswer //
candidateAnswer = input.question(question)

for (let i = 0; i < questions.length; i++) {
let curAnswer = input.question(questions[i]);
candidateAnswers.push(curAnswer);
}
}

function gradeQuiz(candidateAnswers) {

// TODO 1.2c: Let the candidate know if they have answered the question correctly or incorrectly //
if (candidateAnswer === correctAnswer) {
console.log('That is correct!')
} else {
console.log('That is incorrect.')
}

for (let i = 0; i < questions.length; i++) {
console.log(`On Question ${i + 1}, the correct answer is "${correctAnswers[i]}". You answered "${candidateAnswers[i]}".`)
}

let grade; //TODO 3.2 use this variable to calculate the candidates score.

Expand Down

0 comments on commit ddd75eb

Please sign in to comment.