Problem Solving and Office Application Software
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.
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
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
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.