DATE : 2 FEB 2011 ( WED )
PROGRAMMING AND PROBLEM SOLVING
1) Algorithm - Is a sequence of instruction to solve a problem. It can be written in human language and programming language.
Example : Determines the area of rectangle .
FORMULA = WIDTH*HEIGHT
1. Get the width of the rectangle
2. Get the height of rectangle
3. Calculate the area using the formula
4. Annouce the answer
2) Pseudocodes - Is an outline of a program , written in a form that can easily be converted into real programming statements.
Example : Determines the area of rectangle .
FORMULA = WIDTH*HEIGHT
1. Read the width
2. Read the height
3. Set the area to the width multiplied by height
4. Print the area
3) Flowchart - Flowchart is a graphic representation of the logic or steps in a program .
Example of flowchart : start > read width > set the area = width*height > print output > end
4) The software life cycle ( remark list down in exam )
1. Analysis and specification of the task (problem definition)
2. Design of the software (algorithm design)
3. Implementation (coding)
4. Testing
5. Maintenance and evolution of the system
6. Obsolescence
EXERCISE TIME !!!
Question 1 : print the area of circle area
FORMULA : CIRCLE AREA = 3.142*RADIUS*RADIUS
Agorithm : 1. Get the radius of circle
2. Calculate the area of circle with 3.142 multiply radius by radius
3. Display the area of circle
Pseudocode : 1. Read the radius
2. Set the area = 3.142*radius*radius
3. Print output
Flowchart : start > read radius > 3.142*radius*radius > print output > end
Question 2 : Find the celcius
FORMULA : CELCIUS = (5/9)*(FAHREINHEIT-32)
Algorithm : 1. Get the fahreinheit of celcius
2. Calculate the celcius equal to five devide by nine multiple fahreinheit -32
3. Display celcius
Pseudocode :1. Read fahreinheit
2. Set the celcius = (5/9)*(fahreiheit-32)
3. Print output
Flowchart : start > read fahreinheit > calculate (5/9)*(fahreinheit-32) > print output > end
FORMULA : FAHREINHEIT =( 9/5) *( CELCIUS + 32 )
Algorithm : 1. Get the celcius of fahreinheit
2. Calculate the fahreinheit equal nine divide by five multiply celcius 32
3. Display fahreinheit
Pseudocode : 1. Read celcius
2. Set the fahreinheit =(9/5)*(celcius +32)
3. Print output
Flowchart : Start > read celcius > set the fahreinheit = (9/5)*(celcius +32) > print output > end
FINISH CHAPTER 1 !!!!!!!!!!!!!!!!!!
feel so tired to finish it coz this is 1st time i'm create a blog like this !!
0 comments:
Post a Comment