weeks – 01/ 2 introduction to flowcharts components and psuedocode

Post on 26-Mar-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Weeks – 01/2

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

psuedocodepsuedocode

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

3

3

Ms Visio Start all programs ms office ms Visio

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

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

6

6

Flowchart Example-2Start

Input a, b

Sum of a and b

Output the sum of a

and b

End

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

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.

Solution (Flowchart)

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

11

No. 2START

Input Name, Hour, HRate

Fee=hour*HRate

END

Output Name,

Fee

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

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

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.

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.

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.

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

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)

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)

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)

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)

top related