Contents Chapter 1 Computational Thinking. . . . . . . . . . . . . . . . .2 Section 1.1 Computational Thinking. . . 4 Think Like a Computer. . . . . . . . . . . . . . . . . . . . . . 4 Actions of Computational Thinking. . . . . . . . . . . 7 Comparing Problem-Solving to Computational Thinking . . . . . . . . . . . . . . 10 Section 1.2 THINK . . . . . . . . . . . . . . .13 Brief History of Software . . . . . . . . . . . . . . . . . . . 13 Software Development . . . . . . . . . . . . . . . . . . . . . 15 Characteristics of Successful Programmers . . . 18 Chapter 1 Review and Assessment . . . .22 Chapter 2 Encoding. . . . . . . . . . .26 Section 2.1 Hardware . . . . . . . . . . . . .28 Input. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Section 2.2 Software . . . . . . . . . . . . .33 Levels of Languages. . . . . . . . . . . . . . . . . . . . . . . . 33 Procedural versus Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Operating Systems. . . . . . . . . . . . . . . . . . . . . . . . . 37 Section 2.3 Binary Code . . . . . . . . . . .39 Number Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Conversion between Number Systems . . . . . . . 40 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Chapter 2 Review and Assessment . . . .48 Chapter 3 Introduction to Java Programming . . . . . . . . . . . . .52 Section 3.1 Java Program Structure . . .54 Java Compiler and Virtual Machine . . . . . . . . . . 54 Java Program Structure. . . . . . . . . . . . . . . . . . . . . 55 First Java Program . . . . . . . . . . . . . . . . . . . . . . . . . 57 Section 3.2 Understanding Errors. . . . .61 Compiler Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Runtime Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Logic Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 User Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Chapter 3 Review and Assessment . . . .69 Chapter 4 Variables . . . . . . . . . .72 Section 4.1 Identifiers and Data Types . . . . . . . . . . . . . . . . . . . . . .74 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Defining Variables . . . . . . . . . . . . . . . . . . . . . . . . . 80 Section 4.2 Variable Values. . . . . . . . .82 Assigning Values . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Defining Constants . . . . . . . . . . . . . . . . . . . . . . . . 85 Inputting Values from the User. . . . . . . . . . . . . . 87 Chapter 4 Review and Assessment . . . .95 Chapter 5 Java Expressions. . . . . 98 Section 5.1 Arithmetic Operators. . . .100 Binary Operators . . . . . . . . . . . . . . . . . . . . . . . . . 100 Operator Precedence. . . . . . . . . . . . . . . . . . . . . . 103 Shortcut Operators . . . . . . . . . . . . . . . . . . . . . . . 105 Section 5.2 Operators and Expressions. . . . . . . . . . . . . . 110 Data Types and Operations . . . . . . . . . . . . . . . . 110 Common Expression Errors. . . . . . . . . . . . . . . . 114 Section 5.3 Output Results . . . . . . . . 119 Output Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Test Validity of Output . . . . . . . . . . . . . . . . . . . . 125 Chapter 5 Review and Assessment . . .129 Chapter 6 Classes . . . . . . . . . .132 Section 6.1 Introduction to Classes. . .134 Class API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Using the Turtle . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Section 6.2 Java Class Library . . . . . .144 Library Overview. . . . . . . . . . . . . . . . . . . . . . . . . 144 String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Random Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 xiii
Previous Page Next Page