Grade Program

In this assignment you will be given a program that asks for a test score (0 to 100) and will print out an A if the score is 90 or better, a B if the score is in the 80s, and a message that the score is failing if the score is below 60.  You can see the program run here.   Your task is to finish the program so that it prints a C for the scores in the 70s,  and a D for scores in the 60s.   You can copy the source code for the running program, or copy the text below into notepad:

<title> If Demo Page </title>
<script type=”text/javascript”>
function ShowMessage()
// Assumes: gradeBox contains a grade (non-negative number)
// Results: displays a warning or correct letter grade for the score
var grade;

grade = parseFloat(document.getElementById(‘gradeBox’).value);

if (grade < 60) {
alert(‘You failed! Time to hit the books.’);

if (grade>89)
alert(‘You got an A’);

if ((grade > 79) && (grade<90))
alert(‘You got a B’);

Your grade: <input type=”text” id=”gradeBox” size=6 value=””>
<input type=”button” value=”Click for Message” onclick=”ShowMessage();”>