Sie sind auf Seite 1von 30

Problem solving and office application software

Overview
Introduction Problem solving techniques Program control structures Programming paradigms Programming languages Generations of programming languages Language translators Features of good programming language

Introduction
Computer Program? Set of instructions Instructs the computer to perform a task.

Computer language
Computer language or programming language Language that can be understood by the computer.

How to develop a program ?


1.The instructions 2. The order (in which those instructions are to be performed) 3. The data ( to perform those instructions)

Program development cycle


Problem solving steps 7 steps 1. Analyse / Define the problem Identify the scope of the project. 2. Task analysis Solutions to solve the problem. Select the optimum solution. 3. Designing phase Develop the algorithm. Draw flowcharts & write pseudo codes. make program logic clear.

4. Testing the algorithm Before converting the algorithms into actual code it should be checked for accuracy. Major logical errors are identified. 5. Coding Actual coding of the programs. 6. Test and debug the program 7. Documentation and implementation. Once the program is free from all the errors install the program on the end users machine. Provide supporting materials/manuals/doc/etc

Program development cycle

Problem solving Techniques


Algorithms Flow chart Pseudo code

Algorithms
An algorithm is defined as a finite sequence of explicit instructions, which when provided with a set of input values produces an output and then terminates. To be an algorithm, the steps must be unambiguous and after a finite number of steps, the solution of the problem is achieved. 3 features 1. Sequence 2. Decisions 3. Repetitions

Example
Problem : To find the largest of 3 numbers Step 1 Start Step 2 Read the 3 numbers A, B , C Step 3 Find the larger number between A & B and store it in MAX. Step 4 Find the larger number between MAX & C and store it in MAXNEW. Step 5 Display MAXNEW Step 6 Stop

Examples
1. 2. 3. 4. 5. 6. 7. 8. 9. Heat up a cup of water. To wash a car Find the average of 4 numbers Change the time in seconds to minutes Find the product of 2 numbers Find the difference between 2 numbers To count the number of red boxes in a set of red, white and blue boxes. Ask for the length breadth and height of a room . Calculate and display the volume of the room. To repair a puncture on a bike wheel.

FLOWCHART
A flowchart is a pictorial representation of an algorithm in which the steps are drawn in the form of different shapes of boxes and the logical flow is indicated by interconnecting arrows. The boxes represent operations and the arrows represent the sequence in which the operations are implemented.

Benefits of Flowcharts
Makes Logic Clear Communication Effective Analysis Useful in Coding Proper Testing and Debugging Appropriate Documentation

Limitations of Flowcharts
Complex Costly Difficult to Modify No Update

Flowchart Symbols
A flowchart uses special shapes to represent different types of actions or steps in a process. Some standard symbols, which are frequently required for flowcharts, are:

PSEUDOCODE
Pseudo code is a generic way of describing an algorithm without using any specific programming language-related notations. It is an outline of a program, written in a form, which can easily be converted into real programming statements.

Benefits of Pseudocode
Pseudocode provides a simple method of developing the program logic as it uses everyday language to prepare a brief set of instructions in the order in which they appear in the completed program. Language independent Easier to develop a program from pseudocode than a flowchart Easy to translate pseudocode into a programming language Pseudocode is compact and does not tend to run over many pages Pseudocode allow programmers who work in different computer languages Also known as PDL (Program Design Language). Keywords used by pseudocode:
Input: READ, OBTAIN, GET and PROMPT Output: PRINT, DISPLAY and SHOW Compute: COMPUTE, CALCULATE and DETERMINE Add One: INCREMENT

Limitations of Pseudo code


The main disadvantage is that it does not provide visual representation of the programs logic. No accepted standards style of writing pseudo codes. Cannot be compiled or executed and there are no real formatting or syntax rules.

PROGRAM CONTROL STRUCTURES


Program statements that affect the order in which statements are executed, or that affect whether statements are executed, are called control structures. There are three control structures. They are sequential, selection, and repetition. Sequence construct is a linear progression where one task is performed sequentially after another. Selection (Decision) structure allows the program to make a choice between two alternate paths, whether it is true or false. Repetition (Looping) causes an interruption in the normal sequence of processing and directs the system to loop back to a previous statement in the program, repeating the same sequence again.

PROGRAMMING PARADIGMS
Programming paradigm refers to how a program is written in order to solve a problem. Programming can be classified into three categories:
Unstructured Programming Structural Programming Object-Oriented Programming

Unstructured Programming
Unstructured style of programming refers to writing small and simple programs consisting of only one main program. All the actions such as inputs, outputs, and processing are done within one program only.

Structural Programming
Using structural programming, a program is broken down into small independent tasks that are small enough to be understood easily, without having to understand the whole program at once. Each task has its own functionality and performs a specific part of the actual processing. These tasks are developed independently, and each task can carry out the specified task on its own, without the help of any other task. When these tasks are completed, they are combined together to solve the problem.

Object-Oriented Programming
Object-oriented programming is a style of computer programming, which promotes building of independent pieces of code that interact with each other. It allows pieces of programming code to be reused and interchanged between programs.

Das könnte Ihnen auch gefallen