/  301
 
O
bject 
O
riented 
 P
rogrammingvia
 F
ortran 90/95
 Ed Akin
Rice UniversityMechanical Engineering and Materials Science DepartmentHouston, Texas
May 29, 2001Draft # 4.2, Copyrightc
2001, All rights reserved.
 
ii
 
Contents
Preface vii1 Program Design 1
1.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2. Problem Denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3. Modular Program Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.4. Program Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4.1. Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4.2. Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4.3. Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4.4. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.4.5. Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.4.6. Dynamic Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . 151.5. Program evaluation and testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.6. Program documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.7. Object Oriented Formulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181.8. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2 Data Types 23
2.1. Intrinsic Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.2. User Dened Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.3. Abstract Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.4. Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.5. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3 Object Oriented Programming Concepts 33
3.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333.2. Encapsulation, Inheritance, and Polymorphism . . . . . . . . . . . . . . . . . . . . . 343.2.1. Example Date, Person, and Student Classes . . . . . . . . . . . . . . . . . . . 373.3. Object Oriented Numerical Calculations . . . . . . . . . . . . . . . . . . . . . . . . . 383.3.1. A Rational Number Class and Operator Overloading . . . . . . . . . . . . . . 393.4. Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.5. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4 Features of Programming Languages 51
4.1. Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.2. Statements and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.3. Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.3.1. Explicit Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.3.2. Implied Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604.3.3. Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614.4. Subprograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
c
2001 J.E. Akin
iii

Share & Embed

More from this user

Add a Comment

Characters: ...

soil_investleft a comment

Very Good Book

karim07left a comment

hi