// Rule 1: Kinda keep it simple
// As total marks are going to be 100 so no need for a percentage method
const school_grading_system = () => {
let student_details = {
name_of_student: prompt("Enter your name:"),
roll_number_of_student: Number(prompt("Enter your Roll No: ")),
marks_of_student: Number(prompt("Enter your marks out of 100: "))
}
if (student_details.marks_of_student >= 45 && student_details.marks_of_student < 50) {
return "Grade D"
} else if (student_details.marks_of_student >= 50 && student_details.marks_of_student < 60) {
return "Grade C"
} else if (student_details.marks_of_student >= 60 && student_details.marks_of_student < 80) {
return "Grade B"
} else if (student_details.marks_of_student >= 80 && student_details.marks_of_student <= 100) {
return "Grade A"
}
}
console.log(school_grading_system())
// Note: I have not displayed the name and marks stuff because I hope you are capable enough to do that so I am leaving that upon you
solved JS: Grading System of a school Any Fix (Error== undefined) [closed]