2023 In this project you will create and x a document with a simple form that displays the value of a | Assignment Collections

Computer Science 2023 LetterGrades

2023 In this project you will create and x a document with a simple form that displays the value of a | Assignment Collections

In this project, you will create and fix a document with a simple form

that displays the value of a letter grade.

1. Create a new document in your text editor.

2. Type the <!DOCTYPE> declaration, <html> element, document

head, and <body> element. Use the Transitional DTD and

“Letter Grades” as the content of the <title> element.

3. Create a script section in the document head that includes the

following checkGrade() function and switch statement:

<script type=”text/javascript”>

/* <![CDATA[ */

function checkGrade() {

    switch (grade)

        case “A”:

            window.alert(“Your grade is excellent.”;

            break;

        case “B”:

            window.alert(“Your grade is good.”;

            break;

        case “C”:

            window.alert(“Your grade is fair.”;

            break;

        case “D”:

            window.alert(“You are barely passing.”;

            break;

        case “F”:

            window.alert(“You failed.”;

            break;

 default:

           window.alert(“Invalid letter!”;

     }

/* ]]> */

</script>

4. Add the following form to the document body that includes

an onclick event handler that calls the checkGrade()

function. The value of the single text box is passed to the

checkGrade() function.

<form action=””

enctype=”application/x-www-form-urlencoded”>

<p><input type=”text” name=”grade” />

<input type=”button”

value=”Check Grade”

onclick=”checkGrade(this.value);” /></p>

</form>

5. Save the document as LetterGrades.html in the Exercises

folder for Chapter 8, and then open it in your Web browser.

You should receive an error message about a missing brace.

The problem is that the statements within the switch state-

ment are not contained within braces. Modify the switch

statement so that it includes braces, as follows:

switch (grade) {

    case “A”:

        window.alert(“Your grade is excellent.”;

        break;

    case “B”:

        window.alert(“Your grade is good.”;

        break;

    case “C”:

        window.alert(“Your grade is fair.”;

        break;

    case “D”:

window.alert(“You are barely passing.”;

        break;

    case “F”:

        window.alert(“You failed.”;

        break;

    default:

        window.alert(“Invalid letter!”;

}

6. Save the LetterGrades.html document, and reload it in

your Web browser window. You should receive another error

message about a missing closing parenthesis. Each of the

window.alert() statements in the switch statement is miss-

ing a closing parenthesis. Add the closing parenthesis to each

of the window.alert() statements, between the closing quo-

tation mark and the semicolon.

7. Save the LetterGrades.html document, and reload it in your

Web browser window. You should not receive any more error

messages when you reload the page. However, if enter a grade

into the text box and click the Check Grade button, you will see

an additional error about “grade” not being defined. The prob-

lem that causes this error is that the checkGrade() function def-

inition does not include the grade parameter, which is used in

the switch statement to evaluate the letter grade. Add the grade

parameter to the checkGrade() function definition, as follows:

function checkGrade(grade) {

8. Save the LetterGrades.html document, and reload it in your

Web browser window. Try entering a valid grade into the text

box and clicking the Check Grade button. No matter what

value you enter, you will always see the message “Invalid let-

ter!” in the alert box. The problem that is causing this error

is that the button element, which calls the checkGrade()

function, is incorrectly passing a value to the function of

this.value. The value of the grade text box, not the value

of the button, must be passed to the checkGrade() function.

Modify the argument that is passed to the checkGrade()

function, as follows:

onclick=”checkGrade(document.forms[0].grade.value);”

9. Save the LetterGrades.html document, and then validate the

document with the W3C Markup Validation Service. Once

the document is valid, close it in your text editor and reload it

in your Web browser window. The script should now function

correctly.

10. Close your Web

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational