Turbo Pascal: Problem Solving and Program Design

Turbo Pascal: Problem Solving and Program Design

Paperback(2nd ed)

$28.20 $35.25 Save 20% Current price is $28.2, Original price is $35.25. You Save 20%.

Temporarily Out of Stock Online

Eligible for FREE SHIPPING

Overview

Turbo Pascal: Problem Solving and Program Design by Elliot B. Koffman, Bruce R. Maxim

Hallmark Features:
Conveys the relationship between problem-solving skills and effective software development by using the author's classic five-step problem solving process. Covers computer graphics in Chapter 3, and provides examples of animation and user interfaces in later chapters to help motivate students. Introduces abstract data types and units in Chapter 9, and Turbo Pascal objects and object-oriented programming in Chapter 13. This coverage prepares students to study other languages which use the object-oriented paradigm. Reinforces key concepts with proven pedagogical features like programming style sections, syntax displays, end-of-section and end-of-chapter exercises, and more.

Product Details

ISBN-13: 9780201149890
Publisher: Addison-Wesley
Publication date: 03/01/1989
Edition description: 2nd ed
Pages: 79086

Read an Excerpt

PREFACE:

Since the last revision of this book, there have been no new revisions to Turbo Pascal. However, there has been a vast increase in interest in the Internet and the World Wide Web. For that reason, we decided to u pdate this book by adding a chapter discussing the Internet and World Wide Web. This chapter explains how the Internet works and also tells students how to access the World Wide Web as a general resource and as a source of more information about this book. Students can download program files for this book directly from the book's website. The new Chapter 19 provides information on how to do this.

This textbook is intended for a first course in problem solving and program design using Turbo Pascal (version 7.0). It assumes no prior knowledge of computers or programming, and for most of its material, high school algebra is sufficient mathematics background. A limited knowledge of discrete mathematics, however, is desirable for certain sections.

This edition, like its predecessors, closely follows the recommendations of the ACM Computing Curricula Task Force for CS11 and CS22 and the ACM/IEEE-CS Joint Curriculum Task Force.3 We emphasize problem solving, abstraction, and software engineering throughout the text.

New in This Update: Internet and World Wide Web Chapter

Chapter 19 provides an introduction to the Internet, discussing how the Internet works and how students can access the World Wide Web through a web browser. It also describes the use of search engines and demonstrates how students can access the website for the textbook to download program files through FTP. Finally, it discusses Hypertext Markup Language (HTML)and shows students how to use it to create their own web documents.

Problem Solving

The connection between good problem-solving skills and effective software development is established early in Chapter 1 (Overview of Computers and Programming). This chapter also introduces the Turbo Pascal integrated environment. The software development method, introduced in Chapter 2 (Problem Solving and Pascal), is used to solve the first case study and is applied consistently to all the case studies of the text.

Chapter 3 (Functions, Procedures, and Graphics) continues the emphasis on problem solving by discussing top-down design, divide-and-conquer, solution by analogy, and generalization of a solution. An important section of this chapter demonstrates how a Pascal program can be derived by editing the documentation that results from systematically following the software development method.

Graphics

This edition contains an introduction to computer graphics. We describe Turbo Pascal's graphics procedures in Chapter 3 (Functions, Procedures, and Graphics), graphics animation in Chapter 6 (Modular Programming), and user interfaces in Chapter 9 (Software Engineering and Units).

Software Engineering

The text covers many aspects of software engineering. Discussions of program style issues appear throughout in special displays. The concept of a program as a sequence of control structures is introduced early in Chapter 4 (Selection Control Structures: if and case Statements). Several chapters include sections that discuss algorithm tracing, debugging, and testing.

Chapter 9 (Software Engineering and Units) is a complete unit on software engineering. This chapter discusses the system/software life cycle (SLC), prototyping, and programming teams. The in-depth coverage of all phases of the SLC includes more discussion of informal techniques for program testing (e.g., glass box versus black box testing, integration testing, structured walkthroughs) and formal methods for program verification as well as a discussion of loop invariants. This chapter also reviews procedural abstraction and introduces data abstraction. At this point, we introduce Turbo Pascal units and use unit Crt to create a windowlike interface. We also show how to write your own units to implement procedure libraries and abstract data types. Chapter 9 concludes with a discussion of professional ethics.

Procedural Abstraction

Although there is no universal agreement on when to introduce procedures and procedure parameters, most educators do agree on the following points: Procedures should be introduced as early as feasible, procedures should never process global variables (side effects), and procedure parameters are a difficult concept for students to understand. The approach taken in the text is to discuss the importance of program modularization and reusability in Chapter 3 by introducing the standard functions, structure charts, and procedures without parameters. The chapter motivates the use of procedures as program building blocks by showing some applications of procedures without parameters (for example, by displaying long lists of user instructions and drawing diagrams). Chapter 3 then discusses, in Section 3.5, the need for parameters and the limitations of procedures without parameters, thereby providing a foundation for the later study of parameters. Section 3.6 introduces Turbo Pascal's graphics procedures and demonstrates their use.

Chapter 6 (Modular Programming) completes the study of procedures and functions, covering all aspects of parameter lists. The chapter begins by discussing procedures with only value parameters, then value and variable parameters, and finally functions. An optional section at the end of the chapter introduces recursive functions.

Some instructors prefer to cover procedures with and without parameters together. To this end, you can easily rearrange the sequence of topic coverage. If you want to wait until Chapter 6 to cover procedures with and without parameters, defer Sections 3.4 and 3.5 until then. Conversely, if you want to cover procedure parameters earlier, cover Section 6.1 (introduction to parameter lists) right after Chapter 3 and cover Sections 6.2 and 6.3 (variable parameters, syntax of parameter lists) after completing the first three sections of Chapter 4 (control structures, Boolean expressions, and the if statement).

Data Abstraction and Object-Oriented Programming

The software engineering chapter (Chapter 9) introduces data abstraction, providing the first example of an abstract data type (ADT). We introduce enumerated data types and show how to encapsulate a data type and its operators as a Turbo Pascal unit. Data abstraction and ADTs are used extensively in the advanced topics portion of the textbook, starting in Chapter 13.

Chapter 13 (Data Abstraction and Object-Oriented Programming) introduces Turbo Pascal objects and object-oriented programming (OOP) and includes a discussion of inheritance. Objects and OOP are also covered in Chapter 17 (Pointers and Linked Lists) and in Chapter 18 (Dynamic Data Structures).

Interviews with Computer Scientists

A popular feature of the last edition was a collection of interviews with notable computer scientists (Adele Goldberg, David Patterson, and Patrick Winston, among others), which were placed throughout the text. These interviews alert beginning students to the breadth of the subject area, providing them with a description of issues of concern in several fields of computer science (for example, artificial intelligence, operating systems, databases, user interfaces) and some idea of the background preparation needed for success in these fields. We have updated these interviews and provided several new ones in the 5th edition.

Coverage of Theoretical Concepts

This edition covers theoretical topics recommended by the curriculum committee report. An optional section in Chapter 7 introduces numerical computation and iterative approximations. Chapter 9 provides a discussion of program verification, focusing on assertions and loop invariants. Chapter 10 introduces searching and sorting of an array followed by a discussion of algorithm analysis and big-O notation.

Pedagogical Features

We employ several pedagogical features to enhance the usefulness of this book as a teaching tool. Discussion of some of these features follows. Approximately one-third of all exercises, review questions, and programming projects are new to this edition.

End-of-Section Exercises: Most sections end with a number of self-check exercises, including exercises that require analysis of program fragments as well as short programming exercises. Answers to odd-numbered self-check exercises appear at the back of the book; answers to the rest of the exercises are provided in the Instructor's Manual.

End-of-Chapter Exercises: Each chapter ends with a set of quick-check exe rcises and answers. Immediately following are chapter review questions, whose solutions appear in the Instructor's Manual.

End-of-Chapter Projects: Most end-of-chapter projects include one or two special programming project pairs in which the second of the pair requires a modification to the solution of the first project. Solutions to the first project in each pair are available from Addison-Wesley. All project solutions appear in the Instructor's Manual.

Examples and Case Studies: The text contains a large number and variety of programming examples. Whenever possible, examples contain complete programs or procedures rather than incomplete program fragments. Each chapter contains one or more substantial case studies that are solved following the software development method.

Syntax Displays: The syntax displays describe the syntax and semantics of each new Pascal feature and then provide examples. Several syntax diagrams appear in the body of the text; an appendix contains a complete collection of syntax diagrams.

Program Style Displays: The program style displays discuss issues of good programming style. Error Discussions and Chapter Review: Each chapter ends with a section that discusses common programming errors. Chapter reviews include a table of new Pascal constructs.


Coverage of Advanced Topics

The material in Chapters 1 through 12 normally will be covered in the first semester of a course in programming methods. The book contains six additional chapters that cover advanced topics normally studied in the second semester or in the first semester of an accelerated course. This material may be used as a reference for students continuing their study of computer science and, in some cases, may be used as the primary text for a second-semester course. There is certainly sufficient material for a two-quarter sequence. Advanced topics covered include:

Data abstraction and object-oriented programming (Chapter 13)
Recursion (Chapter 14)
Sets and strings (Chapter 15)
External data structures: files (Chapter 16)
Pointers and linked lists (Chapter 17)
Dynamic data structures (Chapter 18)

Appendixes and Supplements

Appendixes: The text concludes with separate appendixes covering the Turbo Pascal environment, language elements, compiler directives, syntax diagrams, and the ASCII code.

Program Files: For case studies, all procedures and functions are incorporated in a single program file. Also available are files containing solutions to selected programming projects. These solutions serve as the starting point for follow-on projects. These files can be downloaded from Addison-Wesley's website and loaded into the Turbo Pascal environment. An icon like the one in the margin appears alongside each program module or project directing the reader to the website at ...

Table of Contents

Overview of Computers and Programming.
Electronic Computers Then and Now.
Introduction to Computer Hardware.
Problem Solving and Programming.
Overview of Programming Language.
Processing High-Level Language Program.
Using the Turbo Pascal Integrated Environment.
Interview: David A. Patterson

Problem Solving and Pascal.
The Software Development Method.
Applying the Software Development Method.
Case Study: Converting Units of Measurement.
Overview of Pascal, Reserved Words, & Identifiers.
Data Types and Declarations.
Executable Statements.
General Form of a Pascal Program.
Arithmetic Expressions.
Case Study: Evaluating Coins.
Formatting & Viewing Program Output.
Debugging and Programming Errors.
Interview: Philippe Kahn

Functions, Procedures, and Graphics.
Building Programs from Existing Information.
Case Study: Finding the Area and Circumference of a Circle.
Case Study: Finding the Most Pizza for Your Money.
Functions.
Top-Down Design and Structure Charts.
Case Study: Drawing Simple Diagrams.
Procedures.
Procedures as Program Building Blocks.
Introduction to Computer Graphics (Optional).
Common Programming Errors.
Interview: James Foley

Selections Structures: If and Case Statements.
Control Structures.
Boolean Expressions.
The if Statement.
Syntax Diagrams.
if Statements withCompound Statements.
Decision Steps in Algorithms.
Case Study: Payroll Problem.
Case Study: Computing Insurance Dividends.
Hand-Tracing an Algorithm.
Nested if Statements & Multiple-Alternative Decisions.
The case Statement.
Common Programming Errors.
Interview: Ellen Isaacs

Repetition: While, For and, Repeat Statements.
The while Statement.
Using Loops to Accumulate a Sum.
Event-Controlled Loops.
Loop Design.
The for Statement.
The repeat Statement.
Nested Loops.
Debugging & Testing Programs.
Common Programming Errors.
Interview: Marie des Jardins

Modular Programming.
Introduction to Parameter Lists.
Returning Information from Procedures.
Syntax Rules for Parameter Lists.
Scope of Identifiers.
Functions: Modules that Return a Single Result.
Stepwise Design with Functions & Procedures.
Case Study: Sum-and -Average Problem.
Debugging & Testing a Program System.
Recursive Functions (Optional).
Graphics Animation (Optional).
Common Programming Errors

Simple Data Types.
Numeric Data Types: Real and Integer.
Boolean Data Type.
The Character Data Type.
Ordinal Functions and Character Functions.
Subrange Types.
Type Compatibility & Assignment Compatibility.
Enumerated Types.
Iterative Approximations (Optional).
Case Study: Approximating the Value of e.
Using the Debugger Evaluate & Modify Dialog Box.
Common Programming Errors.
Interview: Judith Schlesinger

Text Files.
Text Files, Data Files, and Output Files.
Procedures & Functions for Text Files.
Using Text Files.
Case Study: Preparing a Payroll File.
Debugging with Files.
Common Programming Errors.
Interview: Donna August

Software Engineering And Units.
Programming in the Large.
Introduction to Units.
Predefined Units & User Interfaces.
Writing New Units.
Units & Abstract Data Types.
Debugging with Units.
Testing Large Programs.
Formal Methods of Program Verification.
Ethics & Responsibilities.
Common Programming Errors.
Interview: Robert Sedegwick.

Arrays.
The Array Data Structure.
Sequential Access to Array Elements.
Arrays as Parameters & Operands.
Case Study: Home Budget Problem.
Subarray Processing.
Searching & Sorting an Array.
Analysis of Algorithms: Big-O Notation (optional).
Arrays with Type Char Elements & Subscripts.
Case Study: Cryptogram Generator Problem.
Debugging Programs with Arrays.
Common Programming Errors.
Common Programming Errors

Multi-Dimensional Arrays.
Two-dimensional Arrays: Arrays of Arrays.
Processing Two-Dimensional Arrays.
Case Study: Analysis of Sales Data.
Three-Dimensional Arrays.
Debugging Multi Dimensional Arrays.
Common Programming Errors.
Interview: Patrick H. Winston

Records.
The Record Data Type.
Records as Operands & Parameters.
The with Statement.
Arrays of Records.
Hierarchical Records.
Variant Records (Optional).
Debugging Records.
Common Programming Errors.
Interview: Adele Goldberg

Data Abstraction and Object-Oriented Programming.
Data Abstraction and Abstract Data Types.
Objects and Object-Oriented Programming.
Object-Oriented Design.
Inheritance.
Common Programming Errors

Recursion.
Recursive Modules.
Parameter & Local Variable Stacks.
Recursive Mathematical Functions.
Recursive Modules with Array Parameters.
Case Study: Summing the Values in an Array.
Binary Search.
Case Study: Recursive Binary Search.
Problem Solving with Recursion.
Case Study: Towers of Hanoi Problem.
Debugging Recursive Algorithms.
Common Programming Errors

Sets and Strings.
Set Data Type.
Set Operators.
Variable-Length Strings.
String Processing Illustrated.
Case Study: Text Editor.
Common Programming Errors

External Data Structures: Files.
Text File ADT & Binary File ADT.
Creating & Using Binary Files.
File Merge.
Case Study: Merging Two Files.
Direct-Access Files (Optional).
Common Programming Errors

Pointers and Linked Lists.
Pointer Types & Pointers.
Manipulating the Heap.
Linked Lists.
Linked List ADT.
Common Programming Errors

Dynamic Data Structures.
Stacks.
Stack Applications.
Case Study: Reversing a Data Line.
Case Study: Checking for Balanced Parentheses.
Queues.
Binary Trees.
Binary Search Tree ADT.
Efficiency of Binary Search Tree.
Common Programming Errors

Internet and The World Wide Web.
The Internet.
How the Internet Works.
Internet Applications: e-mail, Telnet, and FTP.
The World Wide Web.
Searching the WWW.
Writing Your Own Web Page Using HTML.
Ethics, Security, and Accuracy

Preface

PREFACE:

Since the last revision of this book, there have been no new revisions to Turbo Pascal. However, there has been a vast increase in interest in the Internet and the World Wide Web. For that reason, we decided to u pdate this book by adding a chapter discussing the Internet and World Wide Web. This chapter explains how the Internet works and also tells students how to access the World Wide Web as a general resource and as a source of more information about this book. Students can download program files for this book directly from the book's website. The new Chapter 19 provides information on how to do this.

This textbook is intended for a first course in problem solving and program design using Turbo Pascal (version 7.0). It assumes no prior knowledge of computers or programming, and for most of its material, high school algebra is sufficient mathematics background. A limited knowledge of discrete mathematics, however, is desirable for certain sections.

This edition, like its predecessors, closely follows the recommendations of the ACM Computing Curricula Task Force for CS11 and CS22 and the ACM/IEEE-CS Joint Curriculum Task Force.3 We emphasize problem solving, abstraction, and software engineering throughout the text.

New in This Update: Internet and World Wide Web Chapter

Chapter 19 provides an introduction to the Internet, discussing how the Internet works and how students can access the World Wide Web through a web browser. It also describes the use of search engines and demonstrates how students can access the website for the textbook to download program files through FTP. Finally, it discusses Hypertext Markup Language(HTML)and shows students how to use it to create their own web documents.

Problem Solving

The connection between good problem-solving skills and effective software development is established early in Chapter 1 (Overview of Computers and Programming). This chapter also introduces the Turbo Pascal integrated environment. The software development method, introduced in Chapter 2 (Problem Solving and Pascal), is used to solve the first case study and is applied consistently to all the case studies of the text.

Chapter 3 (Functions, Procedures, and Graphics) continues the emphasis on problem solving by discussing top-down design, divide-and-conquer, solution by analogy, and generalization of a solution. An important section of this chapter demonstrates how a Pascal program can be derived by editing the documentation that results from systematically following the software development method.

Graphics

This edition contains an introduction to computer graphics. We describe Turbo Pascal's graphics procedures in Chapter 3 (Functions, Procedures, and Graphics), graphics animation in Chapter 6 (Modular Programming), and user interfaces in Chapter 9 (Software Engineering and Units).

Software Engineering

The text covers many aspects of software engineering. Discussions of program style issues appear throughout in special displays. The concept of a program as a sequence of control structures is introduced early in Chapter 4 (Selection Control Structures: if and case Statements). Several chapters include sections that discuss algorithm tracing, debugging, and testing.

Chapter 9 (Software Engineering and Units) is a complete unit on software engineering. This chapter discusses the system/software life cycle (SLC), prototyping, and programming teams. The in-depth coverage of all phases of the SLC includes more discussion of informal techniques for program testing (e.g., glass box versus black box testing, integration testing, structured walkthroughs) and formal methods for program verification as well as a discussion of loop invariants. This chapter also reviews procedural abstraction and introduces data abstraction. At this point, we introduce Turbo Pascal units and use unit Crt to create a windowlike interface. We also show how to write your own units to implement procedure libraries and abstract data types. Chapter 9 concludes with a discussion of professional ethics.

Procedural Abstraction

Although there is no universal agreement on when to introduce procedures and procedure parameters, most educators do agree on the following points: Procedures should be introduced as early as feasible, procedures should never process global variables (side effects), and procedure parameters are a difficult concept for students to understand. The approach taken in the text is to discuss the importance of program modularization and reusability in Chapter 3 by introducing the standard functions, structure charts, and procedures without parameters. The chapter motivates the use of procedures as program building blocks by showing some applications of procedures without parameters (for example, by displaying long lists of user instructions and drawing diagrams). Chapter 3 then discusses, in Section 3.5, the need for parameters and the limitations of procedures without parameters, thereby providing a foundation for the later study of parameters. Section 3.6 introduces Turbo Pascal's graphics procedures and demonstrates their use.

Chapter 6 (Modular Programming) completes the study of procedures and functions, covering all aspects of parameter lists. The chapter begins by discussing procedures with only value parameters, then value and variable parameters, and finally functions. An optional section at the end of the chapter introduces recursive functions.

Some instructors prefer to cover procedures with and without parameters together. To this end, you can easily rearrange the sequence of topic coverage. If you want to wait until Chapter 6 to cover procedures with and without parameters, defer Sections 3.4 and 3.5 until then. Conversely, if you want to cover procedure parameters earlier, cover Section 6.1 (introduction to parameter lists) right after Chapter 3 and cover Sections 6.2 and 6.3 (variable parameters, syntax of parameter lists) after completing the first three sections of Chapter 4 (control structures, Boolean expressions, and the if statement).

Data Abstraction and Object-Oriented Programming

The software engineering chapter (Chapter 9) introduces data abstraction, providing the first example of an abstract data type (ADT). We introduce enumerated data types and show how to encapsulate a data type and its operators as a Turbo Pascal unit. Data abstraction and ADTs are used extensively in the advanced topics portion of the textbook, starting in Chapter 13.

Chapter 13 (Data Abstraction and Object-Oriented Programming) introduces Turbo Pascal objects and object-oriented programming (OOP) and includes a discussion of inheritance. Objects and OOP are also covered in Chapter 17 (Pointers and Linked Lists) and in Chapter 18 (Dynamic Data Structures).

Interviews with Computer Scientists

A popular feature of the last edition was a collection of interviews with notable computer scientists (Adele Goldberg, David Patterson, and Patrick Winston, among others), which were placed throughout the text. These interviews alert beginning students to the breadth of the subject area, providing them with a description of issues of concern in several fields of computer science (for example, artificial intelligence, operating systems, databases, user interfaces) and some idea of the background preparation needed for success in these fields. We have updated these interviews and provided several new ones in the 5th edition.

Coverage of Theoretical Concepts

This edition covers theoretical topics recommended by the curriculum committee report. An optional section in Chapter 7 introduces numerical computation and iterative approximations. Chapter 9 provides a discussion of program verification, focusing on assertions and loop invariants. Chapter 10 introduces searching and sorting of an array followed by a discussion of algorithm analysis and big-O notation.

Pedagogical Features

We employ several pedagogical features to enhance the usefulness of this book as a teaching tool. Discussion of some of these features follows. Approximately one-third of all exercises, review questions, and programming projects are new to this edition.

End-of-Section Exercises: Most sections end with a number of self-check exercises, including exercises that require analysis of program fragments as well as short programming exercises. Answers to odd-numbered self-check exercises appear at the back of the book; answers to the rest of the exercises are provided in the Instructor's Manual.

End-of-Chapter Exercises: Each chapter ends with a set of quick-check exe rcises and answers. Immediately following are chapter review questions, whose solutions appear in the Instructor's Manual.

End-of-Chapter Projects: Most end-of-chapter projects include one or two special programming project pairs in which the second of the pair requires a modification to the solution of the first project. Solutions to the first project in each pair are available from Addison-Wesley. All project solutions appear in the Instructor's Manual.

Examples and Case Studies: The text contains a large number and variety of programming examples. Whenever possible, examples contain complete programs or procedures rather than incomplete program fragments. Each chapter contains one or more substantial case studies that are solved following the software development method.

Syntax Displays: The syntax displays describe the syntax and semantics of each new Pascal feature and then provide examples. Several syntax diagrams appear in the body of the text; an appendix contains a complete collection of syntax diagrams.

Program Style Displays: The program style displays discuss issues of good programming style. Error Discussions and Chapter Review: Each chapter ends with a section that discusses common programming errors. Chapter reviews include a table of new Pascal constructs.


Coverage of Advanced Topics

The material in Chapters 1 through 12 normally will be covered in the first semester of a course in programming methods. The book contains six additional chapters that cover advanced topics normally studied in the second semester or in the first semester of an accelerated course. This material may be used as a reference for students continuing their study of computer science and, in some cases, may be used as the primary text for a second-semester course. There is certainly sufficient material for a two-quarter sequence. Advanced topics covered include:

Data abstraction and object-oriented programming (Chapter 13)
Recursion (Chapter 14)
Sets and strings (Chapter 15)
External data structures: files (Chapter 16)
Pointers and linked lists (Chapter 17)
Dynamic data structures (Chapter 18)

Appendixes and Supplements

Appendixes: The text concludes with separate appendixes covering the Turbo Pascal environment, language elements, compiler directives, syntax diagrams, and the ASCII code.

Program Files: For case studies, all procedures and functions are incorporated in a single program file. Also available are files containing solutions to selected programming projects. These solutions serve as the starting point for follow-on projects. These files can be downloaded from Addison-Wesley's website and loaded into the Turbo Pascal environment. An icon like the one in the margin appears alongside each program module or project directing the reader to the website at ...

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews