A school has the following rules for the grading system:
// a. 45 to 50 - D
// b. 50 to 60 - C
// c. 60 to 80 - B
// d.Above 80 - A
Ask the user to enter marks, name as well as Roll No and print the corresponding grade
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: ")),
percentage_obtained_student: function() {
return ((this.marks_of_student / 100) * 100)
}
}
if (this.percentage_obtained_student >= 80 && this.percentage_obtained_student < 80) {
console.log(`${this.percentage_obtained_student}:Good Job! You have scored A Grade`)
} else if (this.percentage_obtained_student >= 60 && this.percentage_obtained_student < 60) {
console.log(`${this.percentage_obtained_student}: Good! You have obtained B Grade`)
} else if (this.percentage_obtained_student >= 50 && this.percentage_obtained_student < 60) {
console.log(`${this.percentage_obtained_student}: Good! You have obtained C Grade`)
} else if (this.percentage_obtained_student >= 45 && this.percentage_obtained_student < 50) {
console.log(`${this.percentage_obtained_student}: Good! You have obtained D Grade`)
}
}
console.log(school_grading_system())