Deliverables:
To complete this assignment you must --
1.) Write the HTML and JavaScript page described below and demonstrate to
the lab instructor that it operates correctly.
2.) Complete the lab during the time provided or email your results to your lab instructors.
3.) Demonstrate youir program(s) to your lab instructor.
Introduction: The goal of this assignment is to give you experience working with IF-THEN-ELSE blocks. IF-THEN-ELSE blocks let you choose what parts of your code execute based on input data.
Procedures:
PART 1:
Here is a brief list of helpful HTML tags and JavaScript functions.
Section | Pseudocode | Comments | |
---|---|---|---|
INPUT: | Number x, y, z; | We require three numbers | |
OTHER VARIABLES: | Number max; | ||
INITIALIZATION: | Assume x, y, and z are given to us. |
||
COMPUTATION: | IF (x > y) THEN max = x; ELSE max = y; ENDIF IF (z > max) THEN max = z; ENDIF |
Convince yourself these comparisons provide the correct result. |
|
OUTPUT: | return(max); | Remember to format your results in a sensible way. |
LetterGrade(x): Computes a letter grade.
Section | Pseudocode | Comments | |
---|---|---|---|
INPUT: | Integer NumGrade; | This is the numeric grade, 0 - 100 percent. |
|
OTHER VARIABLES: | Char AlphGrade; | This is where we will store the letter grade. | |
INITIALIZATION: | Assume NumGrade is given. | ||
COMPUTATION: | IF (NumGrade > 89) THEN AlphGrade = "A"; ELSE IF (NumGrade > 79) THEN AlphGrade = "B"; ELSE IF (NumGrade > 69) THEN AlphGrade = "C"; ELSE IF (NumGrade > 59) THEN AlphGrade = "D"; ELSE AlphaGrade = "F"; ENDIF ENDIF ENDIF ENDIF | Note the use of the "nested" IF-THEN-ELSE structures. It may be easier to do one at a time, then view it. |
|
OUTPUT: | return (AlphGrade); |