Top Banner
1 Weeks – 01/2 Introduction to Introduction to flowchart’s components flowchart’s components and psuedocode and psuedocode
21

Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

Mar 26, 2015

Download

Documents

John Stanley
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

1

Weeks – 01/2

Introduction to flowchart’s Introduction to flowchart’s components and components and

psuedocodepsuedocode

Page 2: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

2

22

ObjectivesHave familiarity using Ms.VisioHave a basic concept in designing solution

using flowcharts. Have a basic concept in designing solution

using pseudo-codes.Have a basic concept in solving problems and

write them as pseudo-codes

Page 3: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

3

3

Ms Visio Start all programs ms office ms Visio

Page 4: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

4

4

Flowchart symbolsTerminator’START’ or ’END’ symbols to begin or terminate flowchart.

Input/OutputData entry or display output program

ProcessTransform data or expression

Conditional / DecisionProcess with selection

PreparationInitialize

Arrowconnection

ConnectorOnline connector

Page 5: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

5

5

Flowchart Example-1START

Nyalakan api kompor

Tuangkan minyak ke wajan

Pecahkan telur ke dalam mangkok

Tambahkan garam

Aduk campuran telur dan garam

Tuang adonan telur dan garam ke dalam wajan

Masak telur hingga matang

END

Hasil=Telur dadar

Page 6: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

6

6

Flowchart Example-2Start

Input a, b

Sum of a and b

Output the sum of a

and b

End

Page 7: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

7

7

Exercise (flowchart)1. Write a letter for your friend by post

2. Calculate employee fee which reads employee name, hours, and hourly rate.

3. Calculate grade a course with formula grade = 30% x Midterm + 20% x Task + 30% x Final+ 20%xQuiz. Input : name of course, Midterm, Quiz, Final, Task

Page 8: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

8

8

Exercise (flowchart)4. Calculating is total of sales by entering the

name of goods, quantity, and price. Output : name of goods and total of purchasing.

5. Calculating area and circumference of circle. With input radius. Output : radius, around and area of circle.

Page 9: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

Solution (Flowchart)

Page 10: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

10

No.1START

Paper, pen

Write a letter on paper Take an envelope

Put a letter in envelopeWrite addressGiving a stamp

Bring a letter to postofiice

END

Page 11: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

11

No. 2START

Input Name, Hour, HRate

Fee=hour*HRate

END

Output Name,

Fee

Page 12: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

12

No.3START

Input course,

midterm,task,Quiz, FTest

grade=0.3*midterm+0.3*Ftest+0.2*Task+0.2*Quiz

END

Output Course, Grade

Page 13: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

13

13

PseudocodePseudocode is informal form for depict of

algorithm like a programming Ianguage. Objective of pseudocode :

Easy to readEasy to understandEasy to get an idea

Page 14: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

14

Pseudocode ExampleSend a letter to friend:

1. Write a letter on a paper.2. Take an envelope.3. Put a letter in an envelope.4. Envelope cover use glue.5. When you remember the address, so writing address at

envelope.6. Otherwise, find in adrress book, then writing address at

envelope.7. Giving stamp on a letter.8. Bring a letter to the postoffice.

Page 15: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

15

15

Exrcise (write a pseudocode)1. Calculate employee fee which reads employee

name, hours, and hourly rate.2. Calculate grade a course with formula grade =

30% x Midterm + 20% x Task + 30% x Final+ 20%xQuiz. Input : name of course, Midterm, Task, Final, Quiz

3. Calculating total of sales by entering the name of goods, quantity, and price. Output : name of goods and total of purchasing.

Page 16: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

16

16

Exercise(write a pseudocode)

4. Calculating area and circumference of circle. With input radius. Output : radius, circumference and area of circle.

5. Changing two number one another. Example initialy number1=4, number2=7, after executing its result number1=7, number2=4

6. Write a program to convert a temperature in degrees Fahrenheit to degrees Celcius and Reamur.

Page 17: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

17

Answers-11. Calculate employee fee which reads employee

name, hours, and hourly rate.Data Dictionary Name : string;Hour,rate, Fee : integer;Algorithm Input(Name, Hour)Rate 8000Fee Hour*Rate

Page 18: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

18

Answers-21. Calculate grade a course with formula grade = 30% x

Midterm + 20% x Task + 30% x Final+ 20%xQuiz. Input : name of course, Midterm, Task, Final, QuizData Dictionary Course : string;MT, FT, Task, Q : integer;Grade :realAlgorithm Input(Course )Input(MT, FT, Task,Q)Grade 0.3*MT+0.2*Task+0.3*FT+0.2*QOutput(Course, Grade)

Page 19: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

19

Answer-3Calculating total of sales by entering the name of

goods, quantity, and price. Output : name of goods and total of purchasingData Dictionary

sGood : string;Q, P, Total : integer;

Algorithm Input(sGood, Q, P )T Q*POutput(sGood, T)

Page 20: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

20

Answer-44. Calculating area and circumference of circle. With

input radius. Output : radius, circumference and area of circle.Data Dictionary radius : integer;Area, C :realAlgorithm Input(radius )Area3.14*radius*radiusC 2*3.14*radiusOutput(‘Area = ’, Area) Output(‘Circumference = ’,C)

Page 21: Weeks – 01/ 2 Introduction to flowcharts components and psuedocode.

21

Answer-5 Changing two number one another. Example

initialy number1=4, number2=7, after executing its result number1=7, number2=4Data Dictionary number1, number2, temp : integerAlgorithmInput(number1, number2)temp number1number1number2number2 tempOutput(number1, number2)