Contents
1.1 Data and Information 1
1.2 Bits and Bytes 1
1.3 Data Representation 2
1.4 Number Systems 2
1.5 Conversions 3
1.6 Digital Character Representation 9
1.7 Algorithms 9
1.8 Flowcharts 10
1.9 Pseudocode 13
1.10 Mathematical Operators 22
ii
Delphi Programming
Chapter 1 Introduction 25
Chapter 2 Arithmetic and Logical Operators 98
Selection Structures/Case statement 101
Math functions 115
Chapter 3 Characters and Strings 122
Looping 137
Chapter 4 Methods 171
One Dimensional Arrays 185
Chapter 5 Text Files 218
Chapter 6 Classes & Objects 233
Chapter 7 Two Dimensional Arrays 265
Chapter 8 Dynamic Components 286
Chapter 9 Normalisation & Data Base Connectivity 288
Chapter 10 Structured Query Language 338
Chapter 11 Guidelines on PAT 382
Appendix Keyboard Shortcuts 396
Unicode Chart 397
Bibliography 398
iii
Table of Contents
Chapter 1
1.1 Introduction to High level programming 25
1.2 A brief history and timeline of Delphi 26
1.3 System Requirements for Delphi 27
1.4 Writing environment 27
1.5 Object oriented programming 28
1.6 DELPHI IDE 30
1.7 Comments 36
1.8 Begin and End 36
1.9 Unicode Values 37
1.10 Starting a Delphi Application 37
1.11 Common components 41
1.12 Naming components 42
1.13 Simple application Activity 46
1.14 Variables 47
1.15 Data types 49
1.16 Simple Application examples 53
1.17 Activity (Simple Introduction) 57
1.18 Numbers and equations 58
1.19 Global variables and local variables 62
1.20 Activity (Use of variables) 65
1.21 Date and Time 75
1.22 Set and Get data from components 76
1.23 Control Strings #9 and #13 77
1.24 Tutorial with all common components 78
1.25 Formatting numbers 88
1.26 Activity (Components) 90
1.27 Input box and Message Dialog boxes 90
1.28 Activity (Input boxes) 96
Chapter 2
2.1 Arithmetic and Logical operators 98
2.2 Order of priority 99
2.3 Scope of a variable 100
2.4 Selection Structures / If statement 101
2.5 Activity (If Statement) 106
2.6 Case statement 110
2.7 Activity (Case Statement) 113
2.8 Math and statistical functions 115
2.9 Activity (Math Functions) 117
iv
Chapter 3
3.1 Characters and strings 122
3.2 String operators and String functions 123
3.3 String procedures 124
3.4 Activity (String Handling) 133
3.5 Looping structures 137
3.6 For Loop 137
3.7 Examples on the for loop 141
3.8 Activity (For loop) 147
3.9 Conditional looping structures 152
3.10 Differences between the While and Repeat Until loops 153
3.11 Activity (Algorithms on While and Repeat) 154
3.12 Rules on algorithms 155
3.13 Activity (While and repeat) 159
3.14 The Character data type 163
3.15 Activity (Character data type) 165
3.16 Validation techniques 166
3.17 Activity (Validation) 170
Chapter 4
4.1 Methods Introduction 172
4.2 Procedures and functions 172
4.3 Activity (Procedures and functions) 176
4.4 Parameter passing 178
4.5 Activity (Parameter passing) 182
4.6 Arrays 185
4.7 Populating an array 185
4.8 Array processing 190
4.9 Sorting an array 195
4.10 Searching an array 197
4.11 Inserting and deleting from an array 201
4.12 Remove duplicates 202
4.13 Activity (Arrays) 204
4.14 Parallel and Linked arrays 208
4.15 Activity (Linked Arrays) 214
v
Chapter 5
5.1 Introduction to text files 218
5.2 Commands 218
5.3 Reading from a text file 219
5.4 Activity (Reading from a text file) 225
5.5 Writing to a text file 226
5.6 Appending to a text file 228
5.7 Activity (Writing to/Adding to text files) 228
Chapter 6
6.1 Classes and Objects 233
6.2 Examples with explanation 233
6.3 Activity (Objects) 246
6.4 Creating objects from text files 252
6.5 Activity (Objects from text files) 257
Chapter 7
7.1 Two Dimensional arrays 265
7.2 Populating an array 265
7.3 Processing and manipulating data in a 2D array 267
7.4 Activity (Two dim arrays) 280
Chapter 8
8.1 Dynamic Components 286
8.2 Example 286
Chapter 9
9.1 Concepts of Normalisation 288
9.2 Rules for Normalisation forms 288
9.3 Examples with Answers 291
9.4 Activity 294
9.5 Data Dictionary 296
vi
9.7 DB CONNECTIVITY 297
9.8 Hierarchy of data 297
9.9 Data types of fields 298
9.10 Create a new database 298
9.11 How to connect the database to a Delphi Application 299
9.12 Data aware components 300
9.13 Linking a DBEdit to a field in the DBGrid 304
9.14 Navigation buttons 305
9.15 Adding a record 305
9.16 Deleting a record 306
9.17 Updating records 307
9.18 Activity (Single table) 308
9.19 Foreign key 314
9.20 Two tables – Example 315
9.21 Activity (Two tables) 322
9.22 Direct connection to database 327
9.23 Example on direct connection 327
Chapter 10
10.1 Structured Query Language 338
10.2 Select SQL with examples 338
10.3 Working with two tables 341
10.4 Insert, Delete and Update 341
10.5 Examples 343
10.6 Activity (SQLs) 348
10.7 Rules on SQL statements 351
10.8 Activity (SQLs) 354
10.9 Activity (SQLs) AND Code Construct 363
Chapter 11
11.1 GRADE 10 Sample PAT 382
11.2 Navigation between forms 384
11.3 Help Screen 384
11.4 Tool tip text 385
11.5 Tab sheets 387
11.6 Password strength 389
11.7 Using text files to save, update and delete data 390
11.8 GIF images 391
11.9 Executing a specific form 391
11.10 GRADE 11 – Use of DB, arrays and Graphs in PAT 393
11.11 Sample PATs with code 394
Appendix
A Keyboard Shortcuts 403
B Unicode Chart 404
C Bibliography 405
Reviews
There are no reviews yet.