Prelude to Programming

by ;
  • ISBN13:


  • ISBN10:


  • Edition: 6th
  • Format: Paperback
  • Copyright: 2014-01-23
  • Publisher: Pearson

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
  • We Buy This Book Back!
    In-Store Credit: $22.05
    Check/Direct Deposit: $21.00
List Price: $140.80 Save up to $107.21
  • Rent Book $84.48
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


Prelude to Programming is appropriate for Pre-Programming and Introductory Programming courses in community colleges, 4-year colleges, and universities. No prior computer or programming experience is necessary although readers are expected to be familiar with college entry-level mathematics.

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 Sixth 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.

Teaching and Learning Experience

This program presents a better teaching and learning experience–for you and your students. It provides:

  • A Language-Independent, Flexible Presentation: The text has been designed so that instructors can use it for students at various levels.
  • Features that Help Solidify Concepts: Examples, exercises, and programming challenges help students understand how concepts in the text apply to real-life programs.
  • Real Programming Experience with RAPTOR: Students gain first-hand programming experience through the optional use of RAPTOR, a free flowchart-based programming environment.
  • Support Learning: Resources are available to expand on the topics presented in the text.

Author Biography

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

0 Introduction 1

0.1 A Brief History of Computers 2

What Is a Computer? 2

Personal Computers 4

The Internet 7

0.2 Computer Basics 8

The Central Processing Unit 9

Internal Memory 9

Mass Storage Devices 10

Input Devices 12

Output Devices 12

0.3 Software and Programming Languages 14

Types of Software 14

Types of Programming and Scripting Languages 15

Chapter Review and Exercises 19


1 An Introduction to Programming 25

In the Everyday World: You Are Already a Programmer! 26

1.1 What Is Programming? 26

A General Problem-Solving Strategy 27

Creating Computer Programs: The Program Development Cycle 28

1.2 Basic Programming Concepts 29

A Simple Program 29

Data Input 32

Program Variables and Constants 34

1.3 Data Processing and Output 37

Processing Data 37

Data Output 41

1.4 Data Types 45

The Declare Statement 45

Character and String Data 45

1.5 Integer Data 48

Operations on Integers 49

1.6 Floating Point Data 50

The Declare Statement Revisited 51

Types of Floating Point Numbers 53

1.7 Running With RAPTOR (Optional) 58

Chapter Review and Exercises 60


2 Data Representation 67

In the Everyday World: It Isn’t Magic–It’s Just Computer Code 68

2.1 Decimal and Binary Representation 68

Bases and Exponents 68

The Binary System 70

2.2 The Hexadecimal System 73

Hexadecimal Digits 73

Using Hexadecimal Notation 77

2.3 Integer Representation 80

Unsigned Integer Format 80

Sign-and-Magnitude Format 81

One’s Complement Format 84

Two’s Complement Format 86

2.4 Floating Point Representation 91

Floating Point Numbers: the Integer Part 91

Floating Point Numbers: the Fractional Part 91

Converting a Decimal Fraction to Binary 93

Putting the Two Parts Together 96

2.5 Putting it All Together 97

Scientific Notation 97

Exponential Notation 98

Base 10 Normalization 99

Normalizing Binary Floating Point Numbers 100

The Excess_127 System 100

Base 2 Normalization 101

Single- and Double-Precision Floating Point Numbers 101

Hexadecimal Representation 104

Chapter Review and Exercises 106


3 Developing a Program 113

In the Everyday World: Planning to Program? You Need

a Plan 114

3.1 The Program Development Cycle 115

The Process of Developing a Program 115

Additional Steps in the Cycle 118

3.2 Program Design 122

Modular Programming 122

3.3 Coding, Documenting, and Testing a Program 131

Coding and Documenting a Program 131

Testing a Program 133

Types of Errors 134

3.4 Commercial Programs: Testing and Documenting 135

The Testing Phase Revisited 136

External Documentation 136

3.5 Structured Programming 138

Flowcharts 138

Control Structures 143

Programming Style 146

3.6 Running With RAPTOR (Optional) 147

Getting Started 148

Introduction to RAPTOR Symbols 149

Variables 151

RAPTOR Symbols 155

Run It: The Sign-In Program 164

Developing the Program 165

Creating the Program in RAPTOR: Input 165

Creating the Program in RAPTOR: Processing 168

Creating the Program in RAPTOR: Output 169

Check It Out 170

Chapter Review and Exercises 172


4 Selection Structures: Making Decisions 179

In the Everyday World: Decisions, Decisions, Decisions . . . 180

4.1 An Introduction to Selection Structures 181

Types of Selection Structures 181

Single- and Dual-Alternative Structures 182

4.2 Relational and Logical Operators 188

Relational Operators 188

Logical Operators 191

Hierarchy of Operations 196

4.3 ASCII Code and Comparing Strings 199

Representing Characters With Numbers 199

4.4 Selecting from Several Alternatives 203

Using If Structures 203

Using Case-Like Statements 206

4.5 Applications of Selection Structures 210

Defensive Programming 210

Menu-Driven Programs 214

4.6 Focus on Problem Solving: A New Car Price Calculator 216

Problem Statement 216

Problem Analysis 217

Program Design 217

Program Code 220

Program Test 220

4.7 Running With RAPTOR (Optional) 221

The Selection Symbol 221

The Call Symbol and Subcharts 224

An Example 226

Run It: The New Car Price Calculator 232

Developing the Program 232

Check It Out 242

Chapter Review and Exercises 243


5 Repetition Structures: Looping 255

In the Everyday World: Doing the Same Thing Over and Over and Knowing When to Stop 256

5.1 An Introduction to Repetition Structures: Computers Never

Get Bored! 257

Loop Basics 257

Relational and Logical Operators 261

5.2 Types of Loops 263

Pre-Test and Post-Test Loops 263

Counter-Controlled Loops 268

5.3 The For Loop 274

The For Statement 275

The For Loop in Action 278

The Careful Bean Counter 281

5.4 Applications of Repetition Structures 286

Using Sentinel-Controlled Loops to Input Data 286

Data Validation 290

The Floor() and Ceiling() Functions 294

Computing Sums and Averages 297

5.5 Focus on Problem Solving: A Cost, Revenue, and Profit Problem 302

Problem Statement 302

Problem Analysis 302

Program Design 304

Program Code 307

Program Test 307

5.6 Running With RAPTOR (Optional) 308

Repetition: The Loop Symbol 308

A Short Example 310

Run It: Encryption: The Secret Message Encoder 312

What is Encryption? 313

Problem Statement 313

Developing the Program 313

Developing the Encrypting Algorithms 314

Check It Out 320

Chapter Review and Exercises 321


6 More about Loops and Decisions 331

In the Everyday World: Loops Within Loops 332

6.1 Combining Loops with If-Then Statements 332

Exiting a Loop 333

6.2 Combining Loops and Decisions in Longer Programs 343

The Length_Of() Function 348

The Print Statement and the New Line Indicator 349

6.3 Random Numbers 353

The Random() Function 353

Not Really Random: The Pseudorandom Number 358

6.4 Nested Loops 359

Nested For Loops 359

Nesting Other Kinds of Loops 364

A Mental Workout: Mind Games 369

6.5 Focus on Problem Solving: A Guessing Game 376

Problem Statement 377

Problem Analysis 377

Program Design 378

Program Code 383

Program Test 383

6.6 Running With RAPTOR (Optional) 385

Two Short Examples 385

Run It: Validating a Password 389

Problem Statement 389

Developing the Program 389

Check the length of the password (4—8 characters) 391

Check the first character of the password (cannot be a number) 393

Check that the password contains one of the special characters (#, *, or $) 394

Chapter Review and Exercises 401


7 Arrays: Lists and Tables 407

In the Everyday World: Organize It with Lists and Tables 408

7.1 One-Dimensional Arrays 409

Array Basics 409

7.2 Parallel Arrays 416

Some Advantages of Using Arrays 420

A Word About Databases 423

7.3 Strings as Arrays of Characters 424

Concatenation Revisited 424

String Length versus Array Size 426

7.4 Two-Dimensional Arrays 429

An Introduction to Two-Dimensional Arrays 430

Using Two-Dimensional Arrays 431

7.5 Focus on Problem Solving: The Magic Square 436

Problem Statement 436

Problem Analysis 437

Program Design 438

Program Code 444

Program Test 444

7.6 Running With RAPTOR (Optional) 445

A Short Example 448

Run It: Self-Grading Math Test 450

Problem Statement 450

Developing and Creating the Program 450

Check It Out 456

Chapter Review and Exercises 459


8 Searching and Sorting Arrays 465

In the Everyday World: Searching and Sorting 466

8.1 Introduction to Searching and Sorting 466

The Serial Search Technique 466

Basic Steps in a Serial Search 467

Pseudocode for a Serial Search 468

8.2 The Bubble Sort Technique 471

Swapping Values 472

Using the Bubble Sort Algorithm 474

8.3 The Binary Search 480

Use the Binary Search for Large Arrays 481

8.4 The Selection Sort 486

General Selection Sort Technique 486

Applying the Selection Sort Technique 488

8.5 Focus on Problem Solving: A Grade Management Program 491

Problem Statement 491

Problem Analysis 491

Program Design 493

Program Code 499

Program Test 500

8.6 Running With RAPTOR (Optional) 500

The Serial Search 500

The Bubble Sort 503

The Binary Search 505

The Selection Sort 507

Run It: Soccer Camp 509

Problem Statement 509

Developing and Creating the Program 509

Check It Out 515

Revise and Improve 516

Check It Out 517

Chapter Review and Exercises 519


9 Program Modules, Subprograms, and Functions 527

In the Everyday World: Living and Programming in ManageablePieces: Subprograms 528

9.1 Data Flow Diagrams, Arguments, and Parameters 529

A Big Sale: The Sale Price Computation Program 529

Data Flow Diagrams 530

An Introduction to Arguments and Parameters 531

9.2 More about Subprograms 537

Value and Reference Parameters 537

How to Tell the Difference between Value and Reference

Parameters 539

Two Helpful Functions: ToUpper() and ToLower() 542

The Scope of a Variable 545

9.3 Functions 550

Built-in Functions 550

User-Defined Functions 553

9.4 Recursion 558

The Recursive Process 558

9.5 Focus on Problem Solving: A Fitness Plan 563

Problem Statement 563

Problem Analysis 563

Program Design 564

Program Code 570

Program Test 570

9.6 Running With RAPTOR (Optional) 573

RAPTOR Built-In Functions (Procedures) 573

Creating a New Procedure 576

Run It: The Fitness Plan 581

Problem Statement 581

Developing and Creating the Program 582

Check It Out 590

Chapter Review and Exercises 592


10 Sequential Data Files 599

In the Everyday World: Keeping it On File 600

10.1 An Introduction to Data Files 601

File Basics 601

Creating and Reading Sequential Files 603

10.2 Modifying a Sequential File 608

Deleting Records 609

Modifying Records 612

Inserting Records 613

Using Arrays in File Maintenance 615

10.3 Merging Sequential Files 617

10.4 Focus on Problem Solving: Control Break Processing 620

Problem Statement 620

Problem Analysis 621

Program Design 622

Coding and Testing the Program 625

10.5 Focus on Problem Solving: The Invoice Preparation

Program 625

Problem Statement 626

Problem Analysis 626

Program Design 627

Program Code 631

Program Test 631

10.6 Running With RAPTOR: (Optional) 632

Creating Data Files with the Redirect_Output() Procedure 632

Displaying Data Files with the Redirect_Input() Procedure 633

The Limitations 636

Run It: Professor Weisheit’s Semester Grades 637

Check It Out 645

Chapter Review and Exercises 647


11 Object-Oriented and Event-Driven Programming 655

In the Everyday World: Objects are Everywhere 656

11.1 Classes and Objects 656

Classes 656

Defining Classes and Creating Objects 659

Creating Objects 661

The Constructor 663

11.2 More Features of Object-Oriented Programming 664

Benefits of Object-Oriented Languages 664

Inheritance and Polymorphism 665

11.3 Object-Oriented Program Design and Modeling 675

Modeling Languages 678

Unified Modeling Language (UML) 678

11.4 Graphical User Interfaces and Event-Driven

Programming 681

Window Components 681

Creating GUI Objects in a Program 682

Event-Driven Programming 684

Handling Events 684

Event-Driven Program Design 687

11.5 Focus on Problem Solving: Another Grade Management

Program 689

Problem Statement 689

Problem Analysis 689

Program Design 690

Program Code 695

Program Test 696

11.6 Running With RAPTOR (Optional) 697

Object-Oriented Mode 697

Creating a Class 697

The main Program 704

Inheritance and Polymorphism 704

Run It: Monster Evasion 705

Problem Statement 705

Developing and Creating the Program 705

The main program 709

Using the Classes 713

Check It Out 716

Chapter Review and Exercises 718


Appendix A:

A Study Skills 727

A.1 Achieving Success in the Course 727

A.2 Using the Textbook 728

A.3 Doing the Homework 729

A.4 Writing Programs 730

A.5 Preparing for Tests 731

A.6 More about Preparing for Tests 732

A.7 Taking Tests 733

A.8 Overcoming Test Anxiety 734

Appendix B:

The ASCII Character Set: Printable Characters 735

Appendix C:

Answers to Self Checks 739

Index 779

Rewards Program

Write a Review