<ul><li>Muhamad Rizal Bin Mohamed Razali </li></ul><ul><li>Programming Concept / ISD </li></ul>Introduction
Course Work Breakdown <ul><li>Quiz =5% </li></ul><ul><li>Midterm =15%() </li></ul><ul><li>Assignment=15%() </li></ul><ul><...
Learning Goals <ul><li>At the end of this module student will be able: </li></ul><ul><ul><li>Read the C program </li></ul>...
Outcome 3   Introduction & Objective <ul><li>Before we start writing a programming  it is essential to have a thorough  un...
Outcome 3 <ul><li>Algorithm  is a sequence of steps or procedure to solve the problem. </li></ul><ul><li>Example:- </li></...
Manual process for enrollment <ul><li>Go to the receptionists  counter  </li></ul><ul><li>Ask registration form </li></ul>...
Online process for enrollment <ul><li>Login to the collage website </li></ul><ul><li>Click at the registration form </li><...
Cont… <ul><li>Can you give me example algorithm how to cook Nasi goreng ? </li></ul>
Cont.. <ul><li>You have several algorithm to achieve the same goal  </li></ul><ul><li>Every algorithm has a different cost...
Pseudocode <ul><li>An outline of a program written in English or the user's natural language; it is used to plan the progr...
Why needs pseudocode? <ul><li>Designing algorithms </li></ul><ul><li>Communicating algorithm to users </li></ul><ul><li>Im...
How to write pseudocode <ul><li>Have a limited vocabulary </li></ul><ul><li>Be easy to learn </li></ul><ul><li>Produce sim...
Pseudocode Meaning Read  name Read a value from input device and store it under the specified name Write  name Write the v...
Case study <ul><li>Write a pseudcedo to show how to withdraw money at ATM machine  </li></ul>
<ul><li>Insert ATM card </li></ul><ul><li>Key in password </li></ul><ul><li>Chose withdraw menu </li></ul><ul><li>Chose ty...
Flow Chart <ul><li>Flow chart is a schematic representation of a process </li></ul><ul><li>Flow chart is a graph consistin...
Cont.. <ul><li>The basic flow chart symbols are as below:- </li></ul>
Descriptions  Symbols Start / End  Input / output Processing / computational Decision making /selection Flow line
Cont… <ul><li>Draw a flow chart based on the pseudocode below. </li></ul><ul><ul><li>display “enter your  name” </li></ul>...
Cont Salary = 5.5 X how many days Display first name I/C numbers & salary Start Enter first name Read first name Enter I/C...
Control Structure <ul><li>A  control structure  is a  design  that  determines  the  logic order  of program instructions ...
The sequence Control Structure <ul><li>Is a series of steps or statements that are executed in order  they are written in ...
Selection control structure <ul><li>The selection control structure defines two courses of action depending on the outcome...
Example… <ul><li>If  password true  </li></ul><ul><ul><li>Chose withdraw menu </li></ul></ul><ul><ul><li>Chose account typ...
Nested selection structure <ul><li>Nested selection structure is a  basic selection structure  that  contains other  if/el...
Cont.. <ul><li>If  password true  </li></ul><ul><ul><li>If  menu equal balance enquiry  </li></ul></ul><ul><ul><li>Chose a...
Repetition Control structure <ul><li>The repetition structure permits a sequence of instruction be executed  repeatedly  u...
Cont.. <ul><li>enter the password </li></ul><ul><li>While  enter password not equal actual password  </li></ul><ul><li>beg...
Summary <ul><li>You learn  concept of problem solving </li></ul><ul><li>Algorithm is sequence of a finite numbers of step ...
Questions <ul><li>Get two numbers as input from the user and display the sum of the two numbers to the screen. </li></ul><...
Upcoming SlideShare
Loading in …5
×

Chap3

2,354 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,354
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
36
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Chap3

  1. 1. <ul><li>Muhamad Rizal Bin Mohamed Razali </li></ul><ul><li>Programming Concept / ISD </li></ul>Introduction
  2. 2. Course Work Breakdown <ul><li>Quiz =5% </li></ul><ul><li>Midterm =15%() </li></ul><ul><li>Assignment=15%() </li></ul><ul><li>Lab=15% </li></ul><ul><li>Final =50% </li></ul>
  3. 3. Learning Goals <ul><li>At the end of this module student will be able: </li></ul><ul><ul><li>Read the C program </li></ul></ul><ul><ul><li>Design pseudocode and flow chat </li></ul></ul><ul><ul><li>Write C program using selection , looping pointer and function command. </li></ul></ul>
  4. 4. Outcome 3 Introduction & Objective <ul><li>Before we start writing a programming it is essential to have a thorough understanding of the problem and carefully planned approach to solve the problem. </li></ul><ul><li>We can use </li></ul><ul><ul><li>Pseudocode </li></ul></ul><ul><ul><li>Flow chart </li></ul></ul><ul><ul><li>method how to solve the problem </li></ul></ul>
  5. 5. Outcome 3 <ul><li>Algorithm is a sequence of steps or procedure to solve the problem. </li></ul><ul><li>Example:- </li></ul><ul><ul><li>Let say you have a friend to enroll as a student at your collage. Can u tell your friend how he/she can enroll as a student at your collouge. </li></ul></ul>
  6. 6. Manual process for enrollment <ul><li>Go to the receptionists counter </li></ul><ul><li>Ask registration form </li></ul><ul><li>Fill all the particulars </li></ul><ul><li>Submit the form </li></ul>
  7. 7. Online process for enrollment <ul><li>Login to the collage website </li></ul><ul><li>Click at the registration form </li></ul><ul><li>Fill up the form </li></ul><ul><li>Click submit button </li></ul>
  8. 8. Cont… <ul><li>Can you give me example algorithm how to cook Nasi goreng ? </li></ul>
  9. 9. Cont.. <ul><li>You have several algorithm to achieve the same goal </li></ul><ul><li>Every algorithm has a different cost and time to accomplish. </li></ul>
  10. 10. Pseudocode <ul><li>An outline of a program written in English or the user's natural language; it is used to plan the program, and also serves as a source for test engineers doing software maintenance, it cannot be compiled. </li></ul><ul><li>You can write pseudocode without even knowing what programming language you will use for final implementation </li></ul>
  11. 11. Why needs pseudocode? <ul><li>Designing algorithms </li></ul><ul><li>Communicating algorithm to users </li></ul><ul><li>Implementing algorithms as programs </li></ul><ul><li>Debugging logic error in programs </li></ul><ul><li>Documenting programs for future maintenance and expansion purpose </li></ul>
  12. 12. How to write pseudocode <ul><li>Have a limited vocabulary </li></ul><ul><li>Be easy to learn </li></ul><ul><li>Produce simple instruction or simple English like narrative notation </li></ul><ul><li>Be capable of describing all algorithm , regardless of their complexity </li></ul>
  13. 13. Pseudocode Meaning Read name Read a value from input device and store it under the specified name Write name Write the value stored under the name to the output device Write string Write whatever appears in the string name = expression Evaluate the expression and store it under specified name IF condition THEN statements In the condition is true then execute the statements otherwise ignore them FOR counter = 1 TO n DO statements Execute the statements ‘n’ times REPEAT Statements UNTIL condition Repeat the statements over and over until the condition is true
  14. 14. Case study <ul><li>Write a pseudcedo to show how to withdraw money at ATM machine </li></ul>
  15. 15. <ul><li>Insert ATM card </li></ul><ul><li>Key in password </li></ul><ul><li>Chose withdraw menu </li></ul><ul><li>Chose type of account </li></ul><ul><li>Enter amount </li></ul><ul><li>Remove ATM card </li></ul><ul><li>Keep the money </li></ul>
  16. 16. Flow Chart <ul><li>Flow chart is a schematic representation of a process </li></ul><ul><li>Flow chart is a graph consisting of geometrical shapes that are connected by flow lines </li></ul><ul><li>In order to use flowcharts to communicate algorithms we must develop some convention for its symbols </li></ul>
  17. 17. Cont.. <ul><li>The basic flow chart symbols are as below:- </li></ul>
  18. 18. Descriptions Symbols Start / End Input / output Processing / computational Decision making /selection Flow line
  19. 19. Cont… <ul><li>Draw a flow chart based on the pseudocode below. </li></ul><ul><ul><li>display “enter your name” </li></ul></ul><ul><ul><li>accept first _name </li></ul></ul><ul><ul><li>display “Enter your I/C number” </li></ul></ul><ul><ul><li>accept ic_number </li></ul></ul><ul><ul><li>display “enter your how many days you works:” </li></ul></ul><ul><ul><li>accept days _your _work </li></ul></ul><ul><ul><li>compute salary= 5.5 X days_your_work </li></ul></ul><ul><ul><li>display first_name , days your work , “your salary this month”,salary </li></ul></ul>
  20. 20. Cont Salary = 5.5 X how many days Display first name I/C numbers & salary Start Enter first name Read first name Enter I/C number Read how many days Enter how many days Read I/C number End
  21. 21. Control Structure <ul><li>A control structure is a design that determines the logic order of program instructions </li></ul><ul><li>Have 3 types of control structures </li></ul><ul><ul><li>Sequence control structure </li></ul></ul><ul><ul><li>Selection control structure </li></ul></ul><ul><ul><li>Repetition control structure </li></ul></ul>
  22. 22. The sequence Control Structure <ul><li>Is a series of steps or statements that are executed in order they are written in an algorithm </li></ul>
  23. 23. Selection control structure <ul><li>The selection control structure defines two courses of action depending on the outcome of a condition </li></ul><ul><li>The selection structure requires use of the keywords if and else . </li></ul>
  24. 24. Example… <ul><li>If password true </li></ul><ul><ul><li>Chose withdraw menu </li></ul></ul><ul><ul><li>Chose account type </li></ul></ul><ul><ul><li>Remove ATM card </li></ul></ul><ul><ul><li>Keep the money </li></ul></ul><ul><li>Else </li></ul><ul><ul><li>Reenter the password </li></ul></ul>
  25. 25. Nested selection structure <ul><li>Nested selection structure is a basic selection structure that contains other if/else structure in it’s then part or else part </li></ul><ul><li>Useful for multi way decision making </li></ul>
  26. 26. Cont.. <ul><li>If password true </li></ul><ul><ul><li>If menu equal balance enquiry </li></ul></ul><ul><ul><li>Chose account type </li></ul></ul><ul><ul><li>Else If menu equal withdraw </li></ul></ul><ul><ul><li>Chose account type </li></ul></ul><ul><ul><li>Else </li></ul></ul><ul><ul><li>Please enter the correct menu </li></ul></ul><ul><ul><li>End if </li></ul></ul><ul><li>Else </li></ul><ul><ul><li>Reenter the password </li></ul></ul><ul><li>End if </li></ul>
  27. 27. Repetition Control structure <ul><li>The repetition structure permits a sequence of instruction be executed repeatedly until a certain condition is reached </li></ul>
  28. 28. Cont.. <ul><li>enter the password </li></ul><ul><li>While enter password not equal actual password </li></ul><ul><li>begin </li></ul><ul><li>Repeat ask user to enter the password </li></ul><ul><li>if user enter 3 times wrong password block the user </li></ul><ul><li>end </li></ul>
  29. 29. Summary <ul><li>You learn concept of problem solving </li></ul><ul><li>Algorithm is sequence of a finite numbers of step arrange in a specific logical order. </li></ul><ul><li>Algorithm can described in term of three basic control structure </li></ul><ul><ul><li>Sequence </li></ul></ul><ul><ul><li>Selection </li></ul></ul><ul><ul><li>repetition </li></ul></ul>
  30. 30. Questions <ul><li>Get two numbers as input from the user and display the sum of the two numbers to the screen. </li></ul><ul><li>Get a series of 5 integers and display the total </li></ul><ul><li>Read two numbers and compare which number is smaller and display the result </li></ul><ul><li>Read 3 numbers and print the largest number </li></ul>

×