Write a function that takes two parameters The first is your
Write a function that takes two parameters. The first is your grade (a number) the second is your name. It will display an alert box that says, your name concatenated with You got the A!, if the number sent to the function as the parameter is greater than 89. If the number is greater than or equal to 87 and less than or equal to 89 it will display B+ is good! followed by your name otherwise it will display your name followed by Time to start studying! HTML
Solution
function result(int marks,String name){ //Function will accept marks and name as parameters
if(marks > 89){ // Condition to check if marks is greater than 89
alert(name + \" you got an A\");
}
else if (marks >= 87 && marks <= 89){
// Above condition is to check if marks is greater than or equal to 87 and less than or equal to 89
alert(\"B+ is good \" + name);
}
else{ //If both the above conditions do not satisfy then following alert will be displayed.
alert(name + \" Time to start studying! HTML\");
}
}
