Brigham Young University - Idaho
Brigham Young University - Idaho
College of Physical Sciences and Engineering
Department of Mechanical Engineering
Class Prep Notes #V1
Fundamentals of Procedural Computer Programming
In this section of the class, we will learn the fundamentals of procedural computer programming. We will be using a computer language called Visual Basic for Applications or VBA. The BASIC programming language has been around since before the development of the personal computer. VBA is a modern version of that language that is coupled with the Microsoft Office applications. As such, it is widely available and quite powerful. Coupling VBA with Excel will allow us to easily extend the functionality of Excel where necessary.
To prepare for class, please read the following sections/chapters from your text, Introduction to VBA for Excel
o Chapter 1 (all) – If You’ve Never Programmed Before
o 11.2 - Flowcharts
Well conceived computer programs do not simply appear on the screen of computer. They require a combination of planning and hard work to develop. Major steps in the program development process include the following:
• Stating the problem
• Planning the logic to solve the problem
• Coding
• Debugging
• Documenting
• Maintenance
Program Logic
One of the most important steps involves planning the program logic. Tools or techniques commonly used to assist in developing the program logic include:
• Algorithms
• Flowcharts
Algorithm
An algorithm may be defined as a set of instructions for solving a problem or a step-by-step procedure for obtaining a solution to a given class of problems. A recipe used to make a cake would be a simple example of an algorithm.
At a high level, most program use the following simplified algorithm:
• Input
• Process
• Output
The following two examples demonstrate simple algorithms. The first is an algorithm to find the area of a rectangle:
• Input:
o Enter length, width
• Process:
o Multiply length times width to obtain area
o Area = length * width
• Output:
o Display area
The second example describes the procedure or algorithm for mailing a letter:
• Get an envelope
• Place letter into envelope
• Seal the envelope
• Address the envelope
• Place stamp on the envelope
• Put the envelope in the mailbox
• Stop – we’re done
Flowcharts
A flowchart is a pictorial representation of an algorithm. In creating an algorithm, standard flowcharting symbols (boxes and symbols of various shapes) are used to enclose the steps of an algorithm. The flow of the algorithm is indicated by lines connected to each of the flowchart symbols. Arrows placed on each line determine the direction of flow.
The most commonly used flowcharting symbols are given in the table below.
Standard Flowcharting Symbols
|Name |Symbol |Description |
|Terminator Box | |Used to show both the start and stop of an algorithm. |
|Operation Box | |Used for computations, assignment statements, definitions, etc. |
|Input/Output Box | |Used to indicate items to be read or written by the algorithm. |
|Decision Box | |Used to pose questions in determining which branch to follow for the |
| | |next instruction. |
|Connector Circle | |Used to connect parts of the flowchart from page to page, etc. |
A flowcharting example of the area of a rectangle is shown in the figure below.
Flowcharting Example: Area of a Rectangle
[pic]
Flowcharting Guidelines
Using the following guidelines will help you create effective flowcharts:
• Flowcharts should begin/end with terminator box.
• There can only be one exit from an operation or input/output box.
• There can only be 2 exits from the decision box (possible exceptions to this rule).
• Flowcharts are written to be a guide for writing actual code. The flowchart should have just enough detail for you to code from.
• Getting started is the hardest for the novice.
o Think in terms of small, sequential operations
o What needs to be done
o What order, i.e., what must come first, etc.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- financial management eugene brigham pdf
- brigham and houston financial managem
- financial management brigham 15th edition
- financial management brigham powerpoints
- brigham financial management pdf
- intermediate financial management brigham pdf
- brigham and houston financial management
- brigham and ehrhardt financial management
- brigham and ehrhardt
- financial management brigham and ehrhardt
- financial management brigham pdf
- university physics young 14th pdf