Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2- Visual Basic Schneider

Similar presentations


Presentation on theme: "Chapter 2- Visual Basic Schneider"— Presentation transcript:

1 Chapter 2- Visual Basic Schneider
Problem Solving Chapter 2- Visual Basic Schneider

2 Program Development Cycle Programming Tools
Outline and Objective Program Development Cycle Programming Tools Chapter 2- Visual Basic Schneider

3 Program Development Cycle:
A step-by-step process enables the programmers to plan their programs, that enables you to use your time efficiently and helps you design error-free programs which produce the desired output. Structured Programming Using top_down design Using modules Using the three basic control structure Defining and Documenting the Problem Desired output Needed input Processing requirements Designing and Documenting a Solution Think of an algorithm , or a method of solution, for the computer to use. This method must be a complete procedure for solving the problem in a finite number of steps. Chapter 2- Visual Basic Schneider

4 Program Development Cycle steps:
1. Analyze: Define the problem. Be sure you understand what the program should do and what the output should be. 2. Design: Plan the solution to the problem. Find a logical sequence of steps that solve the problem (Algorithm). 3. Develop the Interface: Select the objects (text boxes , command buttons, etc.).

5 Program Development Cycle steps:
4. Code: Translate the algorithm into a programming language. 5. Debug and Test: Locate and remove any errors in the program. Testing: is the process of finding errors in a program. Debugging: is the process of correcting errors that are found. Bug: the error in a program. 6. Complete the Documentation: Organize all the materials that describe the program. Debugging and Testing: Syntax error Run-time error Logic error Chapter 2- Visual Basic Schneider

6 Programming Tools (Problem solving tools):
Flowchart Pseudocode Hierarchy Chart (Structure chart) Chapter 2- Visual Basic Schneider

7 Chapter 2- Visual Basic Schneider
What is a flowchart? Diagram that visually represents the steps that the program performs to arrive at a solution. A popular logic tool used for showing an algorithm in graphical form. A flowchart consists of special geometric symbols connected by arrows. Name: Flowlinee: Used to connect symbols and indicate the flow of logic Terminal: Used to represent the beginning or the end of task Input/output: Used for input and output operations, such as reading and printing. Processing: Used for arithmetic and data manipulation operations Decision: Used for any logic or comparison operations. Unlike the two other symbols , which have one entry and one exit flowline, the decision symbol has one entry and two exit paths. Chapter 2- Visual Basic Schneider

8 Chapter 2- Visual Basic Schneider
Continue flowchart Programmer draws flowchart before coding. Most common flowchart symbols are: Flowline: indicates flow of logic. (arrow ) Terminal: represents beginning or end of task (oval ) Input/Output: represents input or output operations (parallelogram ) Processing: data manipulation operations (rectangle ) Decision: used for logic or comparison operation (diamond ) The decision symbol has one entry and two exit paths. The path chosen depends on whether the answer to a question is “yes” or “no.” Chapter 2- Visual Basic Schneider

9 Chapter 2- Visual Basic Schneider
Start Example of Flowchart: Initialize counter and sum to 0 Are there more data? No Yes Get next grade This is a program to insert grades and calculate the average Increment counter Add grade to sum Determine the average grade of a class Average=sum/counter Print the average Chapter 2- Visual Basic Schneider Finish

10 Purpose of Flowcharting:
An aid in developing the logic of a program. Verification that all possible conditions have been considered in a program. Provides means of communication with others about the program. A guide in coding the program. Documentation for the program. Chapter 2- Visual Basic Schneider

11 Chapter 2- Visual Basic Schneider
Desk Checking The process of testing the flowchart with different data as input, and checking the output. The test data should include nonstandard data as well as typical data. Chapter 2- Visual Basic Schneider

12 Chapter 2- Visual Basic Schneider
What is Pseudocode? An algorithm design technique that uses a combination of English words and Visual Basic statements Used to create a rough sketch of the steps required to complete a task The programmer can describe the algorithm without being restricted by any programming rules. The Psedocode can easily be translated into the VB language It is compact and the plan looks like the code to be written.. Chapter 2- Visual Basic Schneider

13 Example of Pseudocode:
Determine the average grade of a class: Initialize Counter and Sum to 0 Do While there are more data Get the next Grade Add the Grade to the Sum Increment the Counter Loop Compute Average = Sum / Counter Display Average Chapter 2- Visual Basic Schneider

14 What is a Hierarchy Chart ? (Structure Chart)
Shows the overall program structure. Describes what each part, or module, of the program does. Also, shows how each module relates to other modules in the program. Chapter 2- Visual Basic Schneider

15 Example of Hierarchy Chart:
Class average Program Get Grade Compute Sum and Number of Grades Calculate Average Display Average Chapter 2- Visual Basic Schneider


Download ppt "Chapter 2- Visual Basic Schneider"

Similar presentations


Ads by Google