Prelude to Programming : Concepts and Design
Prelude to Programming provides beginning students with a language-independent framework for learning core programming concepts and effective design techniques. This approach gives students the foundation they need to understand the logic behind program design and to establish effective programming skills. The Fifth Edition offers students a lively and accessible presentation as they learn core programming concepts - including data types, control structures, data files and arrays, and program design techniques such as top-down modular design and proper program documentation and style. Problem-solving skills are developed when students learn how to use basic programming tools and algorithms, which include data validation, defensive programming, calculating sums and averages, and searching and sorting lists. A copy of the RAPTOR flow-charting software is included with the Fifth Edition.
- Mixed media product | 624 pages
- 203.2 x 251.46 x 38.1mm | 1,020.58g
- 04 Nov 2010
- Pearson Education (US)
- Boston, MA, United States
- 5th edition
About Stewart Venit
Stewart Venit received a PhD in mathematics from the University of California, Berkeley in 1971. For the past two decades, he has taught mathematics at California State University in Los Angeles. Professor Venit is a past department Chair and recipient of the University's Outstanding Professor Award. He has authored numerous journal articles and ten textbooks for mathematics or computer science.Elizabeth Drake has worked full time as a professor in the ITE and Math Departments at Santa Fe CC since 1999. Before that, she was an adjunct professor and lecturer in Math, Computer Science, Physics, and Anthropology at SFC, UF, Three Rivers Community College in Connecticut, and the University of Connecticut. She has earned Master's degrees in Anthropology (A.B.D.) and Counseling, a B.S.E.E. in Electrical Engineering, a B.S. in Physics, B.A. in Sociology, and A.S. in Computer Information Technology.
Table of contents
Preface xv0 Introduction 1In the Everyday World: Computers Everywhere 20.1 A Brief History of Computers 2What Is a Computer? 2Personal Computers 4The Internet 70.2 Computer Basics 8The Central Processing Unit 9Internal Memory 9Mass Storage Devices 10Input Devices 12Output Devices 120.3 Software and Programming Languages 14Types of Software 14Types of Programming Languages 15Chapter Review and Exercises 181 An Introduction to Programming 23In the Everyday World: You Are Already a Programmer! 241.1 What Is Programming? 24A General Problem-Solving Strategy 25Creating Computer Programs: The Program Development Cycle 261.2 Basic Programming Concepts 27A Simple Program 28Data Input 30Program Variables and Constants 321.3 Data Processing and Output 35Processing Data 35Data Output 391.4 Character and String Data 43The Declare Statement 431.5 Integer Data 46Operations on Integers 47The Binary Number System 48Integer Representation 501.6 Floating Point Data 55The Declare Statement Revisited 56Types of Floating Point Numbers 57Floating Point Representation 59Chapter Review and Exercises 622 Developing a Program 69In the Everyday World: Planning to Program? You Need a Plan 702.1 The Program Development Cycle 71The Process of Developing a Program 71Additional Steps in the Cycle 742.2 Program Design 78Modular Programming 782.3 Coding, Documenting, and Testing a Program 86Coding and Documenting a Program 87Testing a Program 89Types of Errors 892.4 Commercial Programs: Testing and Documenting 91The Testing Phase Revisited 91External Documentation 922.5 Structured Programming 94Flowcharts 94Control Structures 99Programming Style 102Chapter Review and Exercises 1043 Selection Structures: Making Decisions 111In the Everyday World: Decisions, Decisions, Decisions... 1123.1 An Introduction to Selection Structures 113Types of Selection Structures 113Single- and Dual-Alternative Structures 1143.2 Relational and Logical Operators 120Relational Operators 120Logical Operators 123Hierarchy of Operations 1283.3 ASCII Code and Comparing Strings 130Representing Characters by Numbers 1303.4 Selecting from Several Alternatives 133Using If Structures 134Using Case-Like Statements 1373.5 Applications of Selection Structures 141Defensive Programming 141Menu-Driven Programs 1443.6 Focus on Problem Solving: A New Car Price Calculator 147Problem Statement 147Problem Analysis 147Program Design 148Program Code 151Program Test 151Chapter Review and Exercises 1524 Repetition Structures: Looping 163In the Everyday World: Loops 1644.1 An Introduction to Repetition Structures:Computers Never Get Bored! 165Loop Basics 165Relational and Logical Operators 168Constructing Flowcharts with a Loop Structure 1694.2 Types of Loops 172Pre-Test and Post-Test Loops 173Counter-Controlled Loops 1774.3 The For Loop 183The For Statement 184The For Loop in Action 187The Careful Bean Counter 1904.4 Applications of Repetition Structures 195Using Sentinel-Controlled Loops to Input Data 195Data Validation 199The Floor() and Ceiling() Functions 203Computing Sums and Averages 2064.5 Focus on Problem Solving: A Cost, Revenue, and Profit Problem 211Problem Statement 211Problem Analysis 211Program Design 213Program Code 216Program Test 216Chapter Review and Exercises 2185 More about Loops and Decisions 225In the Everyday World: Advanced Loops 2265.1 Combining Loops with If-Then Statements 226Exiting a Loop Early 2275.2 Combining Loops with If-Then Structures in Longer Programs 236The Length_of() Function 242The Print Statement and the New Line Indicator 2425.3 Random Numbers 246The Random Function 247Not Really Random: The Pseudorandom Number 2515.4 Nested Loops 252Nested For Loops 253Nesting Other Kinds of Loops 257A Mental Workout: Mind Games 2625.5 Focus on Problem Solving: A Guessing Game 269Problem Statement 270Problem Analysis 270Program Design 271Program Code 276Program Test 276Chapter Review and Exercises 2786 Arrays: Lists and Tables 285In the Everyday World: Arrays 2866.1 One-Dimensional Arrays 287Array Basics 287Parallel Arrays 293Some Advantages of Using Arrays 2966.2 Searching and Sorting Arrays 300The Serial Search Technique 300The Bubble Sort Technique 3046.3 More about Searching and Sorting 312Binary Search 313Selection Sort 3176.4 Strings as Arrays of Characters 322Concatenation Revisited 323String Length versus Array Size 3246.5 Two-Dimensional Arrays 326An Introduction to Two-Dimensional Arrays 326Using Two-Dimensional Arrays 3286.6 Focus on Problem Solving: A Grade Management Program 332Problem Statement 333Problem Analysis 333Program Design 335Program Code 341Program Test 341Chapter Review and Exercises 3427 Program Modules, Subprograms, and Functions 351In the Everyday World: Living and Programming in ManageablePieces: Subprograms 3527.1 Data Flow Diagrams and Parameters 353The Big Sale: The Sale Price Computation Program 353Data Flow Diagrams 354An Introduction to Arguments and Parameters 3557.2 More about Subprograms 362Value and Reference Parameters 362How to Tell the Difference between Value and Reference Parameters 363Two Helpful Functions: ToUpper() and ToLower() 367The Scope of a Variable 3707.3 Functions 374Built-in Functions 374User-Defined Functions 3787.4 Recursion 382The Recursive Process 3837.5 Focus on Problem Solving: A Grade Management Program 388Problem Statement 388Problem Analysis 388Program Design 388Program Code 395Program Test 396Chapter Review and Exercises 3988 Sequential Data Files 405In the Everyday World: Data Files 4068.1 An Introduction to Data Files 407File Basics 407Creating and Reading Sequential Files 4098.2 Modifying a Sequential File 415Deleting Records 415Modifying Records 418Inserting Records 419Using Arrays in File Maintenance 4218.3 Merging Sequential Files 4238.4 Focus on Problem Solving: Control Break Processing 426Problem Statement 427Problem Analysis 427Program Design 429Coding and Testing the Program 4318.5 Focus on Problem Solving: The Invoice Preparation Program 432Problem Statement 432Problem Analysis 432Program Design 434Program Code 438Program Test 438Chapter Review and Exercises 4399 An Introduction to Object-Oriented Programming 447In the Everyday World: Objects 4489.1 Classes and Objects 448Classes 448Defining Classes and Creating Objects 450Creating Objects 453The Constructor 4549.2 More Features of Object-Oriented Programming 456Benefits of Object-Oriented Languages 456Inheritance and Polymorphism 4569.3 Object-Oriented Program Design and UML 468Modeling Languages 470Unified Modeling Language 4719.4 Focus on Problem Solving: Using OOP to Create the Parking LotProgram 474Problem Statement 474Problem Analysis 474Program Design 476Creating the Necessary Submodules 482Program Code 485Program Test 485Chapter Review and Exercises 486Appendix A: Decimal, Binary, and Hexadecimal Representation 493A.1 Bases and Exponents 493Expanded Notation 494A.2 The Binary System 495Converting Binary to Decimal 497A.3 The Hexadecimal System 497Hexadecimal Digits 498Converting Decimal to Hexadecimal 498Converting Hexadecimal to Decimal 500Using Hexadecimal Notation 500Converting Binary to Hexadecimal 501Appendix B: Integer Representation 503B.1 Unsigned Integer Format 503Overflow 504B.2 Sign and Magnitude Format 504Representation of Sign-and-Magnitude Integers 505The Zero 506B.3 One's Complement Format 506The Zero Again 507B.4 Two's Complement Format 508The Two's Complement Zero 511Why the Two's Complement Works 512Appendix C: Floating Point Number Representation 513C.1 Binary Conversions to Floating Point 513Floating Point Numbers-the Integer Part 513Floating Point Numbers-the Fractional Part 513Converting a Decimal Fraction to Binary 515C.2 Putting the Two Parts Together 517C.3 Scientific and Exponential Notation 518Scientific Notation 518Exponential Notation 519C.4 Base 10 Normalization 520C.5 Normalizing Binary Floating Point Numbers 520The Excess_127 System 521Base 2 Normalization 521Single Precision Floating Point Numbers 522C.6 Hexadecimal Representation 525Appendix D: Introduction to RAPTOR 527D.1 What Is RAPTOR? 527D.2 Getting Started 527D.3 Introduction to RAPTOR Symbols and Variables 530Variables 530D.4 RAPTOR Symbols 533Input Symbol 533Assignment Symbol 535Output Symbol 538D.5 Comments 539D.6 Built-in Operators and Functions 541Built-in Constants 542Relational Operators 542Boolean (Logical) Operators 543D.7 Making Decisions: The Selection Symbol 543D.8 Repetition: The Loop Symbol 544D.9 The Call Symbol and Subcharts 547D.10 Arrays 549D.11 Creating and Displaying Data Files 550The Redirect_Output Procedure 550The Redirect_Input Procedure 553The End_Of_Input Function 553D.12 Object-Oriented Mode 554Creating a Class 556Example: Using the Cube Class to Find the Volume of a Cube 557Code the Methods 560The Main Program 563Inheritance and Polymorphism 564Glossary 565Index 585