CSE 3 Fluency in Information Technology, UCSD, Winter 2004
Laboratory 5: To be done in your lab section in
the week of February 2
Since the midterm is this week, the lab is short. You may leave as soon as you finish.
Required supplies: You must bring a blank “IBM formatted” diskette.
In this lab you will practice using if and if-else branches in JavaScript.
All files will be provided by your proctor (except for the ones you write of course).
The rule for computing your final percentage score in this course is:
Lab work 30%, Quizzes 20%, Midterm 20%, and Final 30%.
The file grade1.html is an HTML page with a JavaScript program.
If you enter, your quiz average, lab average, midterm grade, and final exam grade and
Click the button, then it computes your final percentage grade.
Note: this HTML page does not produce a letter grade, just a percentage grade.
You need to compute your own quiz average and lab average from the raw scores, it does
not take a list of lab grades or a list of quiz grades.
Note quiz average is a number between 0 and 10.
All other grades are numbers between 0 and 100
Note: You can only use whole numbers, like 95, not fractions like 99.8
Round all averages to whole numbers before entering on the webpage, If your
Quiz average is 7.6, enter 8.
Note that grade1.html does not include the rule that says; your actual midterm grade is
The larger of what you actually got on the midterm and 90% of what you got on the final.
Modify the file grade1.html to obtain a file grade2.html which does include this midterm rule.
Also add a title (which does no show when page is displayed) and an address section with your email and the date on two lines. The address section will show.
The change to the JavaScript only requires adding one if-branch statement (or one if-else branch statement depending on how you do it.)
After grade2.html is working fine, produce a grade3.html which is just like grade2.html except the title is different and the alert window also includes the phrase “You pass.” if the course final grade is 60% or higher, but says “You fail.” if the course final grade is less than 60%. This only requires one if-else branch statement which replaces the alert window statement in grade2.html.
It might be of help to you to know that less-than-or-equal is written <= in JavaScript.
Save your files grade1.html, grade2.html, and grade3.html. You will need them for a later lab.