Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ENGINEERING PROGRAMMING:
IN C, MATLAB AND JAVA
Mark Austin
Department of Civil Engineering
University of Maryland
College Park, Maryland
David Chancogne
Institute for Systems Research
University of Maryland
College Park, Maryland
Chichester
Weinheim
Brisbane
Singapore
Toronto
CONTENTS
PART 1 :
CHAPTER 2:
2.1
2.2
2.3
2.4
INTRODUCTION TO
ENGINEERING COMPUTATIONS
PRINCIPLES OF ENGINEERING
SOFTWARE DEVELOPMENT
in
v
x
1
3
3
4
6
8
9
19
20
20
22
30
34
CONTENTS
XII
PART 2:
PROGRAMMING TUTORIAL
CHAPTER 3:
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
70
70
71
76
78
81
86
88
91
CONTROL OF FLOW
Introduction
Relational and Logical Operands
Selection Constructs
Iteration Constructs
Comparison of Looping Constructs
Programming Exercises
CHAPTER 7:
7.1
41
42
42
46
52
62
66
67
CHAPTER 6:
6.1
6.2
6.3
6.4
6.5
6.6
41
CHAPTER 5:
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
GETTING STARTED
Key Features of
A Little History
Writing and Compiling a Simple Program
Program 3 . 1 : Print Approximate Value of n
Program 3.2: Compute and Print Area of Circle
Compiling and Running Small Programs
Programming Guidelines
Programming Exercises
CHAPTER 4:
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
39
FUNCTIONS I
Introduction
95
95
96
97
100
107
110
113
116
121
121
121
124
133
142
143
146
146
CONTENTS
XIII
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
CHAPTER 8:
1
2
3
8.4
5
6
7
8
9
8.10
8.11
12
CHAPTER 9:
9.1
9.2
9.3
9.4
9.5
FUNCTIONS II
Introduction
Pointers as Function Arguments
Arrays as Function Arguments
String Functions
Programming Exercises
CHAPTER 10:
10.1
10.2
10.3
10.4
10.5
10.6
10.7
10.8
10.9
148
148
151
162
165
173
175
181
184
184
185
188
190
193
208
21 1
217
217
223
225
232
241
241
241
246
252
262
266
266
267
270
27 1
273
274
278
283
294
CONTENTS
xiv
CHAPTER I I :
11.1
11.2
CHAPTER 12:
12.1
12.2
12.3
12.4
12.5
12.6
12.7
12.8
PART 3:
THE PREPROCESSOR
Basic Concepts
Using p r i n t f O for Buffered Output
Using s c a n f () for Buffered Input
File Input/Output
Program 12.1: Statistics of Weekly Rainfall
Reading Datasets from an Input File
Program 12.2: Memory Reallocation for Datasets
Programming Exercises
CHAPTER 14:
14.1
14.2
14.3
14.4
14.5
14.6
14.7
14.8
MATLAB GRAPHICS
CHAPTER 15:
15.1
15.2
15.3
15.4
15.5
INTRODUCTION TO MATLAB
Getting Started
Variables and Variable Arithmetic
Matrices and Matrix Arithmetic
Control Structures
General-Purpose Matrix Functions
Program Development with M-Files
Engineering Applications
Programming Exercises
300
300
302
309
309
310
316
319
322
326
328
334
337
339
339
342
351
367
372
375
382
402
408
408
417
418
421
423
424
425
425
430
430
434
436
437
457
CONTENTS
PART 4:
xv
CHAPTER 17:
17.1
17.2
17.3
17.4
Getting Started
Program 18.1: "Peace on Earth" Stand-Alone Program
Program 18.2: "Peace on Earth" Java Applet Program
Primitive Data Types
Java Variables
Expressions
Control Statements
Classes and Objects
Class Libraries and Methods
Arrays
Program 18.3: Compute Roots of Quadratic Equation
Program 18.4: Point and Line Segment Operations
Programming Exercises
CHAPTER 19:
19.1
19.2
19.3
19.4
19.5
19.6
19.7
19.8
19.9
Fundamental Concepts
Object-Oriented Software Development
Is Java Object-Oriented?
Review Exercises
CHAPTER 18:
18.1
18.2
18.3
18.4
18.5
18.6
18.7
18.8
18.9
18.10
18.11
18.12
18.13
INTRODUCTION TO JAVA
JAVA GRAPHICS
Introduction
The Java Abstract Windowing Toolkit
AWT Components and Containers
AWT Graphics
AWT Layout Managers
AWT I/O Components
Handling AWT Events
Engineering Applications
Programming Exercises
465
467
467
468
476
481
481
483
488
489
490
490
492
497
501
502
505
506
510
521
527
529
538
548
554
554
555
558
562
569
571
580
590
614
APPENDIX I :
INTRODUCTION TO UNIX
621
APPENDIX 2:
629
REFERENCES
649
INDEX
651