Docsity

Programming Fundamentals: Modular Programming, Loops, and Arrays, Study Guides, Projects, Research of Software Engineering

Partial preview of the text

Download Programming Fundamentals: Modular Programming, Loops, and Arrays and more Study Guides, Projects, Research Software Engineering in PDF only on Docsity!

Programming Fundamentals

Programming Fundamentals by Authors and Contributors is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where otherwise noted. Creative Commons Attribution CC-BY License You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material for any purpose, even commercially. Under the following terms:
  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. See https://creativecommons.org/licenses/by/4.0/ for more information.

Contents

Contents xv About this Book 1 Author Acknowledgements 5

Chapter I. Introduction to

Programming

Systems Development Life Cycle Kenneth Leroy Busbee

Program Design Kenneth Leroy Busbee

Program Quality Dave Braunschweig

Pseudocode Kenneth Leroy Busbee

Flowcharts Kenneth Leroy Busbee

Software Testing Kenneth Leroy Busbee

Integrated Development Environment Kenneth Leroy Busbee

Version Control Dave Braunschweig

Input and Output Kenneth Leroy Busbee

Arithmetic Operators 121 Integer Division and Modulus Kenneth Leroy Busbee

Unary Operations Kenneth Leroy Busbee

Lvalue and Rvalue Kenneth Leroy Busbee

Data Type Conversions 138 Input-Process-Output Model Dave Braunschweig

C++ Examples Dave Braunschweig

C# Examples Dave Braunschweig

Java Examples Dave Braunschweig

JavaScript Examples Dave Braunschweig

Python Examples Dave Braunschweig

Swift Examples Dave Braunschweig

Practice: Data and Operators 177

Chapter III. Functions

Modular Programming 183 Hierarchy or Structure Chart Kenneth Leroy Busbee

Function Examples Dave Braunschweig

Parameters and Arguments Dave Braunschweig

Call by Value vs. Call by Reference Dave Braunschweig

Return Statement Dave Braunschweig and Kenneth Leroy Busbee

Void Data Type 206 Scope Kenneth Leroy Busbee

Programming Style 211 Standard Libraries 217 Program Plan 221 C++ Examples Dave Braunschweig

C# Examples Dave Braunschweig

Java Examples Dave Braunschweig

JavaScript Examples Dave Braunschweig

Python Examples Dave Braunschweig

Swift Examples Dave Braunschweig

Practice: Functions 235

Chapter IV. Conditions

Structured Programming 241 Selection Control Structures 245

Chapter V. Loops

Iteration Control Structures 315 While Loop Kenneth Leroy Busbee

Do While Loop 325 Flag Concept Kenneth Leroy Busbee

For Loop Kenneth Leroy Busbee

Branching Statements Kenneth Leroy Busbee

Increment and Decrement Operators Kenneth Leroy Busbee

Integer Overflow Kenneth Leroy Busbee

Nested For Loops Kenneth Leroy Busbee

Program Plan 356 Loop Examples Dave Braunschweig

C++ Examples Dave Braunschweig

C# Examples Dave Braunschweig

Java Examples Dave Braunschweig

JavaScript Examples Dave Braunschweig

Python Examples Dave Braunschweig

Swift Examples Dave Braunschweig

Practice: Loops Kenneth Leroy Busbee

Chapter VI. Arrays

Arrays and Lists 389 Index Notation 393 Displaying Array Members 397 Arrays and Functions 400 Math Statistics with Arrays 403 Searching Arrays 406 Sorting Arrays 409 Parallel Arrays Dave Braunschweig

Multidimensional Arrays Kenneth Leroy Busbee

Fixed and Dynamic Arrays Dave Braunschweig

Program Plan 420 C++ Examples Dave Braunschweig

C# Examples Dave Braunschweig

Java Examples Dave Braunschweig

JavaScript Examples Dave Braunschweig

Exception Handling 507

Chapter VIII. Object-Oriented

Programming

Objects and Classes Dave Braunschweig

Encapsulation Dave Braunschweig

Inheritance and Polymorphism Dave Braunschweig

C++ Examples Dave Braunschweig

C# Examples Dave Braunschweig

Java Examples Dave Braunschweig

JavaScript Examples Dave Braunschweig

Python Examples Dave Braunschweig

Swift Examples Dave Braunschweig

Practice Kenneth Leroy Busbee

About this Book

A Note to Readers

Welcome to Programming Fundamentals – A Modular Structured Approach, 2nd Edition! The original content for this book was created by Kenneth Leroy Busbee and written specifically for his course based on C++. The goal for this second edition is to make it programming-language neutral, so that it may serve as an introductory programming textbook for students using any of a variety of programming languages, including C++, C#, Java, JavaScript, Python, and Swift. Other languages will be considered upon request. Programming concepts are introduced generically, with logic demonstrated in pseudocode and flowchart form, followed by examples for different programming languages. Emphasis is placed on a modular, structured approach that supports reuse, maintenance, and self-documenting code. As you begin to review this edition, please keep the audience in mind. If something is missing, think about whether that concept applies to programming in general or only to certain programming languages, and whether it is a About this Book | 1

Structures. This textbook/collection covers the first of those three courses. Learning Modules The learning modules of this textbook were written as standalone modules. Students using a collection of modules as a textbook will usually view its contents by reading the modules sequentially as presented by the author of the collection. However, many readers of these modules may find them as a result of an Internet search. The textbook design allows the author of a module to create web links to other modules and Internet locations and designate any necessary prerequisites. Conceptual Approach The learning modules of this textbook were, for the most part, written without consideration of a specific programming language. Concepts are presented generically, with program logic demonstrated first in pseudocode and flowchart format. Language-specific examples follow the general overview. Re-use and Customization The Creative Commons (CC) Attribution-ShareAlike license applies to all modules in this textbook. Under this license, any module may be used or modified for any purpose as long as proper attribution to the original author(s) is About this Book | 3

maintained and you distribute your contributions under the same license. PDF Conversion Problems There are several known PDF printing problems. A description of the known problems are:

  1. When it converts an “Example” the PDF displays the first line of an example properly but indents the remaining lines of the example. This problem occurs for the printing of a book (because it prints a PDF) and downloading either a module or a textbook/collection as a PDF.
  2. Within C++ there are three operators that do not convert properly into PDF format. decrement — which is two minus signs insertion << which is two less than signs extraction >> which is two greater than signs References
  • archive.org: Programming Fundamentals – A Modular Structured Approach using C++ 4 | About this Book