Showing posts with label Unit 3. Show all posts
Showing posts with label Unit 3. Show all posts

Unit 3 - Key Facts

Posted on Friday, May 7, 2010 by B[H] | 0 comments
Labels:

1. The algorithm should be tested at the flowchart stage before being coded
into a program.
2. Pseudocode, flowcharts and structure charts are universal problem solving tools that can be used to construct program in any computer language
3. Flowcharts are used to provide visualization of the flow of certain programming tasks

Unit 3 - Class Average Flowchart

Posted on by B[H] | 0 comments
Labels:

Photobucket

Unit 3 - Using Algorithm and Flowchart in programming

Posted on by B[H] | 0 comments
Labels:

Class average Algorithm

Problem: Calculate and report the grade-point average for a class.

Discussion: The average grade equals the sum of all grades divided by number of students. We need a loop to read and then add (accumulate) the grades for each student in the class. Inside the loop, we also need to total (count) the number of students in the class.

Input: Students grades

Processing: Find the sum of the grades; count the number of students; calculate average grades = sum of grades / number of students.

Output: Average grade.

Unit 3 - Structure Chart

Posted on by B[H] | 0 comments
Labels:

Structure chart is also known as input-process-output or hierarchy chart shows the overall program structure. It refers to planning diagrams similar to a

company’s organization chart. Structure chart depicts the organization of program but omit the specific processing logic. They describe what each part, or module, of the program does and they show how the modules relate to each other. Each module may be subdivided into succession of sub-modules that branch out under it. The charts are read from top to bottom and left to right. Figures 3.3 shows an example of a structure chart. This price of discount item problem was solved by a series of instructions to read data, perform calculations, and display results. Each steps was in sequence; that is we moved from one line to the next without skipping over any lines.

The main benefit of structure charts is in the initial planning program. We break down the major parts of a program so we can see what must be done in general. From this point, we can then refine each module into more detailed plans using flowcharts.

Photobucket

Unit 3 - Pseudocode

Posted on by B[H] | 0 comments
Labels:

Pseudocode is an abbreviated version of actual computer code. The geometric symbols used in flowcharts are replaced by English-like statements that outline the process. Pseudocode looks more like computer code than does flowchart. It allows programmer to focus on the steps required to solve a problem rather than on how to use computer language.

The programmer can describe the algorithm in computer language form without being restricted by the rules of the computer language. When the pseudocode is completed it can be easily translated into any computer language.
The following is pseudocode for the price of discount sales item problem:

Program: determine the price of discount item on sale.
Read price (Input)
Set the value of discount = rate of discount * price entered (Process)
price of discount item = price of item - value of discount (Process)
Display the price after discount (Output)

Pseudocode has several advantages. It is compact and probably will not extend for many pages as flowcharts commonly do. Also the plan looks like the code to be written and preferred by many programmers.

Unit 3 - Flowcharts

Posted on by B[H] | 0 comments
Labels:

Graphic representation of algorithm is known as flowchart which consist of geometric symbols. These symbols are connected by line of arrows called flowlines which indicate the direction of flow of processes or activities. The shape of the symbol indicates the type of operation that is to occur. Flowchart should flow from the top of the page to the bottom. The symbols used in flowchart are standardized.

Photobucket
Photobucket

The main advantage of using a flowchart to plan a task is that it provides a pictorial representation of the task, which makes the logic easier to follow. We can clearly see each and every step and how it is connected to the next step. For example lets look at the discount sales program.

Photobucket

The major disadvantage with flowcharts is that when a program is very large, the flowcharts may continue for many pages, making them difficult to follow and modify.

Unit 3 - Algorithm (Algorithma)

Posted on by B[H] | 0 comments
Labels:

The techniques of selecting program statements and their logical sequencing which emphasize the translating of each step of program outline into one or equivalent C++ instruction is known by algorithm. Every detail, including obvious steps , should appear in algorithm.
You use algorithm everyday to make decisions or perform tasks. For example, a 30% discount sales at the supermarket, you must be able to write program that calculate and display the price of item after discount according to the price entered by consumer:-

i. Request price of item (Input)
ii. Value of discount = rate of discount * price (Process)
iii. Price after discount = price - value of discount (Process)
iv. Display of discount price (Output)

Unit 3 - Introduction The Technique To Develope C++ Programming

Posted on by B[H] | 0 comments
Labels:

The first step in writing instructions to carry out a task is to determine what the output should be – that is, what the task should produce. The second step is to identify the data, or input, necessary to obtain the output. The last step is to determine how to process the input to obtain the desired output. The general process of writing program is to analyze the problem, design and plan the solution, coding


which is to translate the algorithm into a programming language and finally testing and debugging.
In this unit we shall discuss the logical sequence of precise steps that solve the problem known as algorithm and three popular programming tools or techniques used to develop the logic plan: flowcharts, pseudo code and structure chart or input-process-output chart.

Unit 3 - Introduction To The Concept And Basic Instruction Of Programming C++

Posted on by B[H] | 0 comments
Labels:

General Objective : To introduce techniques used in program design.

Specific Objectives : At the end of the unit you will be able to :

- state the techniques of program designing tools
- briefly explain the techniques of designing program by different designing tools
- use algorithm and flowchart to develop computer program


**A recipe provides good and simple example of a plan. The ingredients and the amounts are determined by what is to be baked. That is the output determines the input and processing. The recipe or plan reduces the number of mistakes you might make. Many programmers particularly beginners frequently try to write without first making a careful plan. Step-by step process will enable you to use your time efficiently and help you design error free program that produced the desired output.**