Build a Gradebook App - Build a Gradebook App

Cuéntanos qué está pasando:

The grading table specifies:
A+ = 100
A = 90-99
B = 80-89
C = 70-79
D = 60-69
F = 0-59
However, these expected results dont’s match:
Case 1:
Input: studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)
Expected: “Class average: 71.7. Your grade: F.”
Issue: Average 71.7 should be “C”, not “F”.
Case 2:
Input: studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)
Expected: “Class average: 50.8. Your grade: A+.”
Issue: Average 50.8 should be “F”, not “A+”.

Tu código hasta el momento

function getAverage (scores){
  let result = 0;
  for(let score of scores){
    result = result + score;
  }
  let average = result / scores.length;
  return average;
}
function getGrade(average){
  if(average === 100){
    return "A+";
  } else if(average >= 90 && average <= 99){
    return "A";
  } else if(average >= 80 && average <= 89){
    return "B";
  } else if(average >= 70 && average <= 79){
    return "C";
  } else if(average >= 60 && average <= 69){
    return "D";
  } else if(average >= 0 && average <= 59){
    return "F";
  }
}
function hasPassingGrade (grade){
  if(grade === "F"){
    return false;
  } else {
    return true;
  }
}
function studentMsg(passing, grade){
  if(passing){
    return `Class average: ${average}. Your grade: ${grade}. You passed the course.`;
  } else {
    return `Class average: ${average}. Your grade: ${grade}. You failed the course.`;
  }
}
let scores = [100, 75, 20, 60, 80];
let average = getAverage(scores);
let grade = getGrade(average);
let passing = hasPassingGrade(grade);
let msg = studentMsg(passing, grade);
console.log(msg);

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Información del Desafío:

Build a Gradebook App - Build a Gradebook App

Second parameter of the studentMsg is the score that should be changed into Your grade, not the average of class scores.

You should have a function named studentMsg that takes an array of scores and a student score as the parameters.

The parameters you are passing to studentMsg are incorrect. Look at the examples of calling that function in Tests #20 and #21.

no, hte student grade comes from 37, not the average

the student grade comes from 100, not the average

Cuéntanos qué está pasando:

The requirement is to return “false” if the grade is “F”. My implementation does exactly that.
However, I received feedback staiting it must return “false” for “F”, which is already the case. This aligns with the specification, so the feedback seems incorrect.

Tu código hasta el momento

function getAverage (scores){
  let result = 0;
  for(let score of scores){
    result = result + score;
  }
  let average = result / scores.length;
  return average;
}
function getGrade(average){
  if(average === 100){
    return "A+";
  } else if(average >= 90 && average <= 99){
    return "A";
  } else if(average >= 80 && average <= 89){
    return "B";
  } else if(average >= 70 && average <= 79){
    return "C";
  } else if(average >= 60 && average <= 69){
    return "D";
  } else if(average >= 0 && average <= 59){
    return "F";
  }
}
function hasPassingGrade (grade){
  if(grade === "F"){
    return false;
  } else {
    return true;
  }
}
function studentMsg(passing, grade){
  if(passing){
    return `Class average: ${average}. Your grade: ${grade}. You passed the course.`;
  } else {
    return `Class average: ${average}. Your grade: ${grade}. You failed the course.`;
  }
}
let scores = [100, 75, 20, 60, 80];
let average = getAverage(scores);
let grade = getGrade(average);
let passing = hasPassingGrade(grade);
let msg = studentMsg(passing, grade);
console.log(msg);

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Información del Desafío:

Build a Gradebook App - Build a Gradebook App

read again the description of what hasPassingGrade is called with
it’s not called with a letter grade