| How to Use This Book |
|
iv | |
| Preface |
|
vi | |
| Start-Up Checklists |
|
viii | |
| UNIT 1 Introducing Programming Logic and Languages |
|
|
Introducing Programming Logic and Languages |
|
|
2 | (14) |
|
What Is a Computer Program? |
|
|
2 | (1) |
|
|
|
3 | (1) |
|
|
|
4 | (2) |
|
Introduction to Programming Languages |
|
|
6 | (4) |
|
Languages to be Discussed |
|
|
10 | (1) |
|
Choosing and Using a Language |
|
|
11 | (1) |
|
|
|
12 | (4) |
| UNIT 2 Introduction to Visual Basic |
|
|
A First Look at Microsoft Visual Basic |
|
|
16 | (15) |
|
Introduction to Microsoft Visual Basic |
|
|
16 | (1) |
|
|
|
16 | (1) |
|
Opening an Existing Visual Basic Project |
|
|
17 | (1) |
|
Components of the Compiler |
|
|
18 | (7) |
|
Running a Visual Basic Program |
|
|
25 | (1) |
|
Positioning a Form in a Visual Basic Program |
|
|
26 | (1) |
|
|
|
27 | (1) |
|
|
|
28 | (3) |
|
Forms, Controls, and Properties |
|
|
31 | (17) |
|
|
|
31 | (4) |
|
|
|
35 | (1) |
|
Viewing and Modifying Properties |
|
|
35 | (3) |
|
|
|
38 | (3) |
|
|
|
41 | (2) |
|
Setting Additional Properties |
|
|
43 | (2) |
|
|
|
45 | (3) |
|
|
|
48 | (16) |
|
|
|
48 | (1) |
|
Accessing the Code Window |
|
|
49 | (1) |
|
Adding Code to a Command Button |
|
|
50 | (2) |
|
Adding an Image to a Form |
|
|
52 | (1) |
|
|
|
53 | (2) |
|
Setting Properties from Code |
|
|
55 | (2) |
|
Setting the Cancel and Default Command Button Properties |
|
|
57 | (1) |
|
Creating a Standalone Program |
|
|
57 | (2) |
|
|
|
59 | (5) |
|
|
|
64 | (18) |
|
Performing Calculations in Visual Basic |
|
|
64 | (1) |
|
|
|
65 | (1) |
|
Using the Addition and Assignment Operators |
|
|
66 | (1) |
|
Using Text Boxes and the Val Function |
|
|
67 | (1) |
|
Splitting Code Statements among Lines |
|
|
68 | (3) |
|
Using the Subtraction Operator |
|
|
71 | (1) |
|
|
|
72 | (2) |
|
Using the Multiplication and Division Operators |
|
|
74 | (1) |
|
|
|
74 | (1) |
|
Performing Integer Division and Using Modulus |
|
|
75 | (3) |
|
|
|
78 | (4) |
|
Exponentiation, Order of Operations, and Error Handling |
|
|
82 | (17) |
|
|
|
82 | (1) |
|
|
|
82 | (3) |
|
Using the Visible Property to Enhance Output |
|
|
85 | (2) |
|
|
|
87 | (1) |
|
|
|
87 | (4) |
|
|
|
91 | (1) |
|
Controlling Program Flow around the Error Handler |
|
|
92 | (3) |
|
|
|
95 | (4) |
|
|
|
99 | (16) |
|
|
|
99 | (1) |
|
Using the AutoSize Property |
|
|
100 | (2) |
|
|
|
102 | (2) |
|
|
|
104 | (2) |
|
|
|
106 | (2) |
|
Using the Variant Data Type and Option Explicit |
|
|
108 | (2) |
|
|
|
110 | (5) |
|
Strings and Decimal Types |
|
|
115 | (19) |
|
Declaring String Variables |
|
|
115 | (1) |
|
Assigning Text to String Variables |
|
|
116 | (2) |
|
|
|
118 | (4) |
|
|
|
122 | (2) |
|
Using the Format Function |
|
|
124 | (2) |
|
Using the Enabled Property |
|
|
126 | (1) |
|
Using the SelStart and SelLength Properties |
|
|
127 | (3) |
|
|
|
130 | (4) |
|
|
|
134 | (19) |
|
The Building Blocks of Decision Making |
|
|
134 | (1) |
|
Using Conditional Operators |
|
|
135 | (1) |
|
|
|
136 | (2) |
|
Creating and Reading Flowcharts |
|
|
138 | (1) |
|
Using If...Else Statements |
|
|
139 | (2) |
|
|
|
141 | (5) |
|
|
|
146 | (2) |
|
|
|
148 | (5) |
|
Nested If Statements and Option Buttons |
|
|
153 | (18) |
|
Using Nested If Statements |
|
|
153 | (2) |
|
|
|
155 | (6) |
|
Using a Form Load Event Procedure |
|
|
161 | (2) |
|
|
|
163 | (2) |
|
|
|
165 | (6) |
|
|
|
171 | (19) |
|
|
|
171 | (1) |
|
|
|
171 | (4) |
|
Using the InputBox Function |
|
|
175 | (4) |
|
Using the DoEvents Statement |
|
|
179 | (4) |
|
|
|
183 | (2) |
|
|
|
185 | (5) |
|
For Next Loops and Multiple Forms |
|
|
190 | (32) |
|
Using the Print Statement |
|
|
190 | (2) |
|
|
|
192 | (2) |
|
|
|
194 | (2) |
|
Changing Label Font Settings |
|
|
196 | (2) |
|
|
|
198 | (7) |
|
|
|
205 | (2) |
|
|
|
207 | (15) |
|
|
|
211 | (6) |
|
|
|
217 | (5) |
| UNIT 3 Introduction to C++ |
|
|
Entering, Compiling, and Running a C++ Program |
|
|
222 | (11) |
|
|
|
222 | (1) |
|
|
|
223 | (4) |
|
From Source Code to Finished Product |
|
|
227 | (3) |
|
|
|
230 | (3) |
|
|
|
233 | (18) |
|
Understanding Variables and Constants |
|
|
233 | (1) |
|
|
|
234 | (1) |
|
Declaring and Naming Variables |
|
|
235 | (4) |
|
Characters and the Char Data Type |
|
|
239 | (2) |
|
Floating-Point Data Types |
|
|
241 | (3) |
|
|
|
244 | (1) |
|
|
|
244 | (3) |
|
|
|
247 | (4) |
|
|
|
251 | (14) |
|
|
|
251 | (2) |
|
|
|
253 | (4) |
|
Using Operators in Output Statements |
|
|
257 | (1) |
|
|
|
258 | (1) |
|
Incrementing and Decrementing |
|
|
258 | (3) |
|
|
|
261 | (1) |
|
|
|
262 | (3) |
|
How Data Types Affect Calculations |
|
|
265 | (11) |
|
|
|
265 | (4) |
|
|
|
269 | (1) |
|
|
|
269 | (1) |
|
Floating-Point Rounding Errors |
|
|
270 | (2) |
|
|
|
272 | (4) |
|
Strings and the String Class |
|
|
276 | (12) |
|
Introduction to Strings and Literals |
|
|
276 | (1) |
|
Introduction to Classes and Objects |
|
|
277 | (1) |
|
|
|
278 | (2) |
|
|
|
280 | (4) |
|
|
|
284 | (4) |
|
|
|
288 | (17) |
|
|
|
288 | (2) |
|
New Line and Other Special Characters |
|
|
290 | (3) |
|
|
|
293 | (2) |
|
Using the I/O Manipulators |
|
|
295 | (3) |
|
|
|
298 | (1) |
|
|
|
298 | (3) |
|
Clearing the Screen and Printing a Hard Copy |
|
|
301 | (1) |
|
|
|
302 | (3) |
|
Building Blocks of Decision Making |
|
|
305 | (11) |
|
Decision Making in Programs |
|
|
305 | (2) |
|
Representing True and False in C++ |
|
|
307 | (1) |
|
|
|
307 | (2) |
|
|
|
309 | (3) |
|
|
|
312 | (1) |
|
|
|
313 | (3) |
|
|
|
316 | (14) |
|
Introduction to Selection Structures |
|
|
316 | (1) |
|
|
|
316 | (3) |
|
|
|
319 | (1) |
|
|
|
320 | (4) |
|
|
|
324 | (3) |
|
|
|
327 | (3) |
|
|
|
330 | (16) |
|
|
|
330 | (1) |
|
|
|
330 | (4) |
|
|
|
334 | (4) |
|
Stopping in the Middle of a Loop |
|
|
338 | (2) |
|
|
|
340 | (2) |
|
|
|
342 | (4) |
|
Building Programs with Functions |
|
|
346 | (13) |
|
How to Build Programs with Functions |
|
|
346 | (5) |
|
Functions and Program Flow |
|
|
351 | (3) |
|
|
|
354 | (2) |
|
|
|
356 | (3) |
|
Passing Data and Using Library Functions |
|
|
359 | (25) |
|
Getting Data to and from Functions |
|
|
359 | (5) |
|
Dividing the Series Program into Functions |
|
|
364 | (1) |
|
|
|
365 | (1) |
|
|
|
366 | (1) |
|
Functions for Working with Characters |
|
|
367 | (3) |
|
|
|
370 | (14) |
|
|
|
373 | (5) |
|
|
|
378 | (6) |
| UNIT 4 Introduction to Web Programming with HTML and JavaScript |
|
|
|
|
384 | (23) |
|
|
|
384 | (1) |
|
Uncover the Page Beneath the Page |
|
|
385 | (3) |
|
Enter Your Mystery Tags and Old-Fashioned Way |
|
|
388 | (2) |
|
Save and View Your HTML Page |
|
|
390 | (6) |
|
|
|
396 | (3) |
|
Numbered and Bulleted Lists |
|
|
399 | (8) |
|
HTML Organization Techniques |
|
|
407 | (22) |
|
Creating Better Web Pages |
|
|
407 | (1) |
|
Single and Double Spacing |
|
|
408 | (3) |
|
Lines and Background Colors |
|
|
411 | (3) |
|
Hyperlinks Inside Your Document |
|
|
414 | (3) |
|
Creating Hypertext Links to the Web |
|
|
417 | (4) |
|
Linking to Pages You've Already Created |
|
|
421 | (4) |
|
|
|
425 | (4) |
|
|
|
429 | (23) |
|
|
|
429 | (1) |
|
Font Attributes and Values |
|
|
430 | (3) |
|
Downloading and Inserting Graphics |
|
|
433 | (5) |
|
|
|
438 | (4) |
|
|
|
442 | (4) |
|
|
|
446 | (6) |
|
|
|
452 | (22) |
|
The Exciting World of JavaScript |
|
|
452 | (1) |
|
An Introduction to JavaScript |
|
|
453 | (1) |
|
|
|
454 | (2) |
|
Enhancing the Appearance of Your Web Page |
|
|
456 | (2) |
|
Conditional Statements in JavaScript |
|
|
458 | (6) |
|
Using the JavaScript Alert () Method |
|
|
464 | (3) |
|
Accessing the Browser Status Line |
|
|
467 | (7) |
|
Using Images with JavaScript |
|
|
474 | (32) |
|
Making Graphic Images Come Alive |
|
|
474 | (1) |
|
Teaching an Image to Roll Over |
|
|
475 | (3) |
|
Teaching a Hyperlink to Roll Over |
|
|
478 | (2) |
|
Creating a Cycling Banner |
|
|
480 | (5) |
|
|
|
485 | (3) |
|
Creating a JavaScript ``Slide Show'' |
|
|
488 | (18) |
|
|
|
496 | (5) |
|
|
|
501 | (5) |
| UNIT 5 Introduction to Java |
|
|
Integrating Applets into Web Pages |
|
|
506 | (15) |
|
|
|
506 | (1) |
|
|
|
506 | (2) |
|
|
|
508 | (5) |
|
Passing Parameters to Applets |
|
|
513 | (4) |
|
|
|
517 | (4) |
|
Introduction to Java Programming |
|
|
521 | (12) |
|
|
|
521 | (1) |
|
|
|
521 | (3) |
|
From Source Code to a Finished Product |
|
|
524 | (3) |
|
First Steps: An Introduction to Object-Oriented Programming |
|
|
527 | (1) |
|
|
|
528 | (1) |
|
Building Programs Using Objects |
|
|
529 | (1) |
|
|
|
530 | (3) |
|
|
|
533 | (16) |
|
|
|
533 | (1) |
|
|
|
533 | (3) |
|
|
|
536 | (6) |
|
Object-Oriented Data Types and Strings |
|
|
542 | (4) |
|
|
|
546 | (3) |
|
|
|
549 | (20) |
|
|
|
549 | (1) |
|
The Fundamental Operators |
|
|
549 | (7) |
|
Counting by One and the Order of Operations |
|
|
556 | (3) |
|
How Data Types Affect Calculations |
|
|
559 | (4) |
|
Using the Random Number Class |
|
|
563 | (2) |
|
|
|
565 | (4) |
|
I/O and Exception Handling |
|
|
569 | (14) |
|
|
|
569 | (1) |
|
|
|
569 | (4) |
|
|
|
573 | (4) |
|
|
|
577 | (4) |
|
|
|
581 | (2) |
|
Decision Making in Programs |
|
|
583 | (25) |
|
|
|
583 | (1) |
|
The Building Blocks of Decision Making |
|
|
583 | (8) |
|
|
|
591 | (14) |
|
|
|
605 | (3) |
|
|
|
608 | (18) |
|
|
|
608 | (1) |
|
|
|
609 | (4) |
|
|
|
613 | (9) |
|
|
|
622 | (4) |
|
|
|
626 | (18) |
|
|
|
626 | (1) |
|
|
|
627 | (1) |
|
Using Sequential-Access Files |
|
|
628 | (6) |
|
Using Random-Access Files and Multiple Files |
|
|
634 | (7) |
|
|
|
641 | (3) |
|
Developing and Inheriting Classes |
|
|
644 | (20) |
|
|
|
644 | (1) |
|
|
|
645 | (7) |
|
|
|
652 | (4) |
|
Children of Java: Inheritance |
|
|
656 | (5) |
|
|
|
661 | (3) |
|
|
|
664 | (15) |
|
|
|
664 | (1) |
|
|
|
665 | (3) |
|
|
|
668 | (3) |
|
Using Vectors to Store Objects |
|
|
671 | (5) |
|
|
|
676 | (3) |
|
|
|
679 | (23) |
|
|
|
679 | (1) |
|
|
|
679 | (6) |
|
|
|
685 | (3) |
|
|
|
688 | (14) |
|
|
|
690 | (5) |
|
|
|
695 | (7) |
| Appendix A: ASCII Tables |
|
702 | (5) |
| Appendix B: The Binary Number System |
|
707 | (5) |
| Appendix C: The Programming Process |
|
712 | (5) |
| Appendix D: Order of Operations |
|
717 | (4) |
| Appendix E: The bool Data Type |
|
721 | (1) |
| Index |
|
722 | |