23.07.2013 Views

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2008934301<br />

Chapter 14 <strong>JavaScript</strong>/<strong>JScript</strong>: <strong>Control</strong> <strong>Structures</strong> I 425<br />

1 <br />

2 <br />

3 <br />

4<br />

5 <br />

6 Analysis of Examination Results<br />

7<br />

8 <br />

9 // initializing variables in declarations<br />

10 var passes = 0, // number of passes<br />

11 failures = 0, // number of failures<br />

12 student = 1, // student counter<br />

13 result; // one exam result<br />

14<br />

15 // process 10 students; counter-controlled loop<br />

16 while ( student 8 )<br />

34 document.writeln( "Raise Tuition" );<br />

35 <br />

36<br />

37 <br />

38 <br />

39 Click Refresh (or Reload) to run the script again<br />

40 <br />

41 <br />

Fig. 14.11 <strong>JavaScript</strong> program for examination-results problem (part 1 of 5).<br />

e-Business and e-Commerce: How to Program, by Harvey M. Deitel, Paul J. Deitel, and Tem R. Nieto. Published by Prentice Hall.<br />

Copyright © 2001 by <strong>Pearson</strong> Education, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!