Fundamentals of Computer Programming Using Java

[Pages:60]Fundamentals of Computer Programming Using Java

EU V Contents Chapter 1 - Course Introduction ............................................................................................................. 9 naut ACourse Objectives .......................................................................................................................... 10

Course Overview ........................................................................................................................... 12

ho Using the Workbook ...................................................................................................................... 13

ri L Suggested References ..................................................................................................................... 14 zed U Chapter 2 - Basic Concepts and Definitions .......................................................................................... 17 repr A What is a Program? ........................................................................................................................ 18

"Hello, world!" ................................................................................................................................ 20

od The Programming Process .............................................................................................................. 22

u T Program Files and Program Execution ............................................................................................. 24

c System Programs vs.Application Programs ..................................................................................... 26

tion I Input - Process - Output ................................................................................................................. 28 o O Programming Languages ................................................................................................................. 30

Compiler Errors vs. Runtime Errors ................................................................................................. 32

r d Development Environments ............................................................................................................. 34

is N Review Questions ........................................................................................................................... 36

tr Labs ............................................................................................................................................... 38

ibutio C Chapter 3 - Writing Simple Programs .................................................................................................... 41 n Reading Input ................................................................................................................................. 42 is O Performing Numeric Calculations .................................................................................................... 44 p Formatting Output .......................................................................................................................... 46 r Decision Making ............................................................................................................................. 48 oh P Iteration .......................................................................................................................................... 50 ib Commenting Your Source Code ...................................................................................................... 52 ite Y Good Programming Style ................................................................................................................ 54 d. Labs ............................................................................................................................................... 56

? 2015 ITCourseware, LLC

Rev 4.2.1

Page iii

Fundamentals of Computer Programming Using Java

Chapter 4 - Data Types, Constants, and Variables ................................................................................. 59

EA Program's Purpose is to Process Data ......................................................................................... 60 Computer Memory ......................................................................................................................... 62 Data Can Be of Different Types ...................................................................................................... 64

U VNamed Data: Variables ................................................................................................................... 66 nLiteral Data .................................................................................................................................... 68 aut A Assignment ..................................................................................................................................... 70 Printing Variables ............................................................................................................................ 72 ho Review Questions ........................................................................................................................... 74 ri L Labs ............................................................................................................................................... 76

zed U Chapter 5 - Screen Output and Keyboard Input .................................................................................... 79 repr A Writing to the Screen ...................................................................................................................... 80

Characters That Have Special Meaning ........................................................................................... 82

od Some Simple Formatting ................................................................................................................. 84

u T Reading from the Keyboard ............................................................................................................ 86

c Prompting and Validating ................................................................................................................. 88

tion I Example 5 - Formatting Output Data ............................................................................................... 90 o O Review Questions ........................................................................................................................... 92

Labs ............................................................................................................................................... 94

r dis N Chapter 6 - Expressions ....................................................................................................................... 97 trib Expressions: Where the Work Gets Done ........................................................................................ 98 utio C Expression Evaluation: The Result ................................................................................................. 100 Arithmetic Expressions .................................................................................................................. 102 n Relational Expressions .................................................................................................................. 104 is O Where are Relational Expressions Used? ....................................................................................... 106 p And? . . . Or? . . . ......................................................................................................................... 108 r Precedence andAssociativity ........................................................................................................ 110 oh P Example 6 - Calculating Miles Per Gallon ...................................................................................... 112 ib Review Questions ......................................................................................................................... 114 ited. Y Labs ............................................................................................................................................. 116

Page iv

Rev 4.2.1

? 2015 ITCourseware, LLC

Fundamentals of Computer Programming Using Java

Chapter 7 - Decision Making .............................................................................................................. 119

E Sequential Execution ..................................................................................................................... 120 What is Decision Making? ............................................................................................................ 122 Simple Decisions: if ....................................................................................................................... 124

U VTwo-Way Decisions: else .............................................................................................................. 126 n Code Blocks ................................................................................................................................ 128 aut ANesting Control Statements ........................................................................................................... 130 Multi-Way Decisions: switch ......................................................................................................... 132 ho Example 7 - Printing Letter Grades Based On Scores .................................................................... 134 ri L Review Questions ......................................................................................................................... 136 ze Labs ............................................................................................................................................. 138 d reU Chapter 8 - Looping ........................................................................................................................... 141 pr A Kinds of Loops ............................................................................................................................ 142 od Iterative Loops ............................................................................................................................. 144 u T Code Blocks and Loops ............................................................................................................... 146 c Nested Loops .............................................................................................................................. 148 tion I Conditional Loops ........................................................................................................................ 150 o O Infinite Loops ............................................................................................................................... 152 Example 8 - ASimple Menu Program ........................................................................................... 154 r d Review Questions ......................................................................................................................... 156 is N Labs ............................................................................................................................................. 158 tr Labs (contd.) ................................................................................................................................ 160 ibutio C Chapter 9 - Methods .......................................................................................................................... 163 n Programming Without Methods ..................................................................................................... 164 is O Reusable Code in a Method .......................................................................................................... 166 p The Starting Point ......................................................................................................................... 168 r Variable Visibility: Scope ............................................................................................................... 170 oh P Parameters ................................................................................................................................... 172 ib Returning a Value .......................................................................................................................... 174 ite Y Method Stubs ............................................................................................................................... 176 d Libraries ....................................................................................................................................... 178 . Example 9 ? Square and Square Root ........................................................................................... 180 Review Questions ......................................................................................................................... 182 Labs ............................................................................................................................................. 184

? 2015 ITCourseware, LLC

Rev 4.2.1

Page v

Fundamentals of Computer Programming Using Java

Chapter 10 - Debugging ..................................................................................................................... 187

EWhat is Debugging? ...................................................................................................................... 188 Commenting Out Code ................................................................................................................. 190 Simple Debugging with Print Statements ........................................................................................ 192

U VMaking Debugging Print Statements Conditional ............................................................................ 194 nPrograms that Help You Debug Programs ...................................................................................... 196 aut A Example 10 - Debug Statements ................................................................................................... 198 Review Questions ......................................................................................................................... 200 ho Labs ............................................................................................................................................. 202

rizedLU Chapter 11 - Data Collections ? Arrays ............................................................................................... 205 r Scalar Data vs. Data Collections ................................................................................................... 206 epr A What is anArray? ......................................................................................................................... 208 AccessingArray Elements ............................................................................................................. 210 od MultidimensionalArrays ................................................................................................................ 212 u T ArrayInitialization ......................................................................................................................... 214 c Example 11 - CalculatingAverage Rainfall ..................................................................................... 216 tion I Review Questions ......................................................................................................................... 218 o O Labs ............................................................................................................................................. 220

r dis N Chapter 12 - Data Collections - Classes ............................................................................................. 223 t What is a Class? ........................................................................................................................... 224 rib Object vs. Class ........................................................................................................................... 226 utio C Accessing Object Members .......................................................................................................... 228 UsingArrays with Classes ............................................................................................................. 230 n Example 12 - Customer ................................................................................................................ 232 is O Review Questions ......................................................................................................................... 234 prohibitPed. Y Labs ............................................................................................................................................. 236

Page vi

Rev 4.2.1

? 2015 ITCourseware, LLC

Fundamentals of Computer Programming Using Java

Chapter 13 - Working with Files ......................................................................................................... 239

E Terminal I/O and File I/O .............................................................................................................. 240 Opening Files ............................................................................................................................... 242 Opening a File for Writing ............................................................................................................. 244

U VOpening a File for Reading ............................................................................................................ 246 n Checking for File Open Errors ...................................................................................................... 248 aut AClosing a File ................................................................................................................................ 250 Text Files vs. Binary Files .............................................................................................................. 252 ho Example 13 - A Customer Record in a File .................................................................................... 254 ri L Review Questions ......................................................................................................................... 256 ze Labs ............................................................................................................................................. 258 d reUprodAuctioTn oIr dOistribNution Cis proOhibitPed. Y Index............................................................................................................................................ 261

? 2015 ITCourseware, LLC

Rev 4.2.1

Page vii

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download