SlideShare a Scribd company logo
1




         COMP 102:
         PROGRAMMING I
           SPRING 2012

Material is based on
*Programming Logic and Design, Fifth Edition, Comprehensive Chapter 1
* Introduction to Programming in C++: Algorithms,Flowcharts and Pseudocode by Brent
Daviduck
Course Outline
Instructor Information:
Name Ms. Saira Anwar
Email
SairaAnwar@fccollege.edu.pk
SairaAnwar@hotmail.com
Office S – 211
Office Hours
Monday, Wednesday 10:00 – 11:00
Tuesday, Thursday 11:00 – 12:00
Class Meet Tuesday, Thursday       9:00 – 10:50 AM
Category
•Core course for all Computing Majors
•Recommended General Education Course for students with
some enthusiasm to learn programming and who want to feel real
flavor of writing a program
Pre- Requisite Nil
Website https://sites.google.com/site/comp102seca/
Course Outline

   Text Book
   Java in Two Semesters by Quentin Charatan and Aaron Kans
   Java 6 Illuminated Second Edition By Julie Anderson, Herve Franceschi
   Reference Books
   Art and Science of Java by Eric Roberts
   Thinking in Java, by Bruce Eckel
   Java, The Complete Reference, by Patrick Naughton, Herbert Schildt
   Java and Object Orientation: An introduction, John Hunt
   The Java Handbook , by Patrick Naughton, Michael Morrison
   Java in a Nutshell: A Desktop Quick Reference for Java Programmers , by
    David Flanagan
   The Java Language Specification , by James Gosling , Bill Joy, Guy Steele
   Who's Afraid of Java?, by Steve Heller
Course Outline
Grading:
     Lab Quiz (Consider them   45%
     exams)
     Assignments and Quiz      7%
     Project                   7%
     Group Quiz                1%
     Mid (Out of class)        20%
     Final                     20%
     Total                     100.00%

•REGRADING CAN BE REQUESTED WITHIN
FOLLOWING TIME LIMITS:
QUIZZES AND HOMEWORKS: 2DAYS, EXAMS: 3DAYS
Course Outline
Attendance and Quiz Policy:
•Attendance in class is mandatory.
•Inadequate attendance (less than 85%)
may lead to disqualification from the
Midterm and/or Final Exams.
•Take attendance on random days.
•There could be both announced and un-
announced quizzes
•Deadlines are hard deadlines.
Course Outline
Academic Honest:
•What is plagiarism?
“Plagiarism is defined as presenting someone
  else’s work as your own. Work means any
  intellectual output, and typically includes
 text, data, images, sound or performance.”
    (Office of Academic Appeals & Regulation 2005)

  Office of Academic Appeals & Regulation, 2005, Section 2.1 of
  the published procedures on “ Cheating, plagiarism and
  fraudulent or fabricated coursework ” (available online at
  http://www.leeds.ac.uk/AAandR/cpff.htm - accessed 6th Aug
  2005)
Course Outline
Plagiarism is serious:
•All cases are reported and go on your
student record.
•Penalties vary from written warnings, re-
sitting modules to expulsion from the
University.
•Why? – plagiarism undermines the
University’s reputation and the quality of its
degrees and research, plus plagiarists miss
out on learning!
Course Outline
Plagiarism Detection:
•Subject experts knowledge of the discipline
and its literature.
•Changes in writing style, inappropriate
writing style.
•Electronically.
Course Outline
References:
•“Write the text taken from others in double
quotes and italicize the text. Put referencec
at the end.”[1].
•If your ideas match to someone put
references [2].
•If you want to put multiple references. Put
them like it [3][4][5][6].
•You have to double quote the major terms
like “Software Engineering”.
Course Outline




 “The   only stupid question is the
         one which is never
         asked”[Unknown]
Good programmers can rule the
              kingdom !
11
Understanding Computer
 Components and Operations
12


    Hardware and software: the two major
     components of any computer system
    Hardware: equipment, or devices
    Software: programs that contain instructions for
     the computer
    Four major operations in a computer:
        Input
        Processing
        Output
        Storage
Program


           Input (Data)    PROGRAM      Output (Results)
                          (Algorithm)




13
     Takes some values as INPUT
     PROCESS Them
     Produce some result as OUTPUT
Programming Task
14



        A typical programming task can be divided into
         two phases:
        Problem solving phase
            produce an ordered sequence of steps that describe
             solution of problem
            this sequence of steps is called an algorithm
        Implementation phase
            implement the program in some programming
             language
Understanding Computer
 Components and Operations
15



    Input devices: allow data to enter the computer
        Mouse, keyboard, scanner
    Processing: working on the data
        Organizing data
        Checking data for accuracy
        Mathematical or other manipulations on data
    Central Processing Unit (CPU): hardware that
     performs the tasks
Understanding Computer
16
     Components and Operations
        Output devices: provide data to the user
            Printer, monitor, speakers
        Programming language: special language
         containing instructions for the computer
            Visual Basic, Java, C#, C++, COBOL
        Syntax: rules governing word usage and
         punctuation in the language
Understanding Computer
17
     Components and Operations
    Machine language: controls the computer’s on/off
     circuitry
    Compiler or interpreter: software that translates
     programming languages to machine language
    Program must be free of syntax errors to be run, or
     executed, on a computer
    To function properly, the logic must be correct
    Algorithm = Syntax + Semantics
Understanding
18
     the Programming Process
        Six programming phases:
          Understand the problem
          Plan the logic
          Code the program
          Use software to translate the program to
           machine language
          Test the program
          Put the program into production
Understanding the Problem
19


        May be the most difficult phase
        Users may not be able to articulate their needs
         well
        User needs may be changing frequently
        Programmers may have to learn the user’s
         functional job tasks
        Failure to understand the problem is the major
         cause of most project failures
Planning the Logic
20

 Plan the steps that the program will take
 Use tools such as flowcharts and pseudocode

 Flowchart: a pictorial representation of the

  logic steps
 Pseudocode: Natural language representation

  of the logic
 Walk through the logic before coding by desk-

  checking the logic
Pseudo Code and Flow Charts
21

        Pseudo Code
          Algorithms written in structural English

          Good way to begin a solution design

          Program flow is not always clear

        Flow Charts
          Graphical representation

          Express flow of control
Using Software to Translate the
Program into Machine Language
22




          Creating an executable program
Points to Note:
23

1.   The process consists of repeated application of
     simple steps
2.   All steps are unambiguous (clearly defined)
3.   We are capable of doing all those steps
4.   Only a limited no. of steps needs to be taken
5.   Once all those steps are taken according to the
     prescribed sequence, the required result will be
     found
6.   Moreover, the process will stop at that point
24



 Constructs

     Basic
     Programming
     Tools
Sequence/ Sequential Execution
 Unconditional
  Transfer
 Input or output

 Processing




                          25
Branching
   Conditional Transfer




                           ??




                                26
Loops
   Conditional Loop
   Counted Loop




                       27
Three constructs
28
Flowcharts for three constructs
29
Using Flowchart Symbols and
30
     Pseudocode Statements
31




FLOW CHARTS
Elements of Flowcharts
32

           Symbol    Name
                     Flowline


                     Terminal


                     Input/Output


                     Processing


                     Decision
Continued…
33

          Symbol   Name

                   Connector


                   Off page Connector


                   Predefined process


                   Annotation
Simple Sequence




34
IFTHENELSE Structure
35
DOWHILE Structure
36
DEVELOPING
FLOWCHARTS
Putting algorithms to work
What is a flowchart?
   Flowcharts are one method for creating an
    Algorithm.
   They allow a process to be described in a
    step-by-step manner.
   Other Algorithm types are Pseudocode and
    Prose.
Terminators
Start      Oval Shape
           One line in or out
           Used to indicate the beginning
            and end of a process


 Stop
Data Boxes
            Parallelogram shaped
 Input      One line in, One line out
            Used to indicate the input or
             output of data from the system.



Output
Process Boxes
              Rectangle shaped
              One line in, One line out
              Used to indicate a process step
 Process
Decision Boxes
              Diamond shaped
              One line in, two lines out
              Must contain a binary
Yes/No         question (Yes/No,
Question       True/False, 0/1, etc)
              Used to branch a program
               dependent upon a condition
               being met
Subprocess Box
                Rectangle shaped, with
                 bars on the sides
                One line in, One line out
Subprocess      Used to include a
                 predefined process
Bad design…
             What is wrong with this
              chart?
             The box has two lines in,
              one line out…
             Lines must join other
              lines, never boxes!
Bad design…
            What is wrong with this
             flowchart?
            Never use curved lines.
            Always straight
             Always vertical or
             horizontal.
Remember…
   Drawing flowcharts is actually easy.
   Breaking tasks into small steps is often much
    harder than it might seem.
   If you can flowchart it, you can program it.
Flowchart Conversion from Fahrenheit-to-
     Celsius
47
Flowchart for Computing sum,
     product and average
48

                    Start
                    Start

           Prompt the user and get
           Prompt the user and get
           number1 and number2
            number1 and number2


         sum = number1 + number2
          sum = number1 + number2


        product = number1 **number2
         product = number1 number2


               average =sum/2
                average =sum/2


        Print sum, product and average
        Print sum, product and average


                    End
                    End
Flowchart for Computing circumference and
area of a circle
49
                         Start
                         Start


                 Prompt the user and
                  Prompt the user and
                get radius of the circle
                 get radius of the circle


             circumference = 2*3.14*radius
              circumference = 2*3.14*radius


              Area = 3.14*radius*radius;
              Area = 3.14*radius*radius;


                Print circumference and
                Print circumference and
                    area of the circle
                     area of the circle


                         End
                         End
Flowchart for Computing min and max of 2
numbers
50


                       Start
                       Start

      Prompt the user and get number1 and number2
      Prompt the user and get number1 and number2


                                        yes
               number1 < number2 ?
                number1 < number2 ?

                       no
                                                    min = number1
                                                    min = number1
                    min = number2
                    min = number2
                                                    max = number2
                                                    max = number2
                    max = number1
                    max = number1




                 Print min and max
                 Print min and max

                        End
                        End
Flowchart : Computing min of 3 numbers
51
               Start
                Start

            Prompt the user and
             Prompt the user and
     get number1, number2 and number3
      get number1, number2 and number3

                                yes
        number1 < number2 ?
         number1 < number2 ?
               no

                               yes                                    yes
        number2 < number3 ?
         number2 < number3 ?                   number1 < number3 ??
                                                number1 < number3

               no                                     no
           min = number3
           min = number3       min = number2
                               min = number2      min = number3
                                                  min = number3       min = number1
                                                                      min = number1




             Print min
              Print min
                End
                 End
Flowchart Computing min of 3
     numbers
52
                  Start
                   Start

             Prompt the user and
              Prompt the user and
      get number1, number2 and number3
       get number1, number2 and number3

            min = number1
            min = number1

                              yes
            number2 < min?
             number2 < min?

             no                min = number2
                               min = number2



                              yes
            number3 < min?
             number3 < min?

             no                min = number3
                               min = number3



              Print min
               Print min
                  End
                   End

More Related Content

What's hot

POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
Program logic formulation
Program logic formulationProgram logic formulation
Program logic formulationSara Corpuz
 
Program Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State UniversityProgram Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State University
Reggie Niccolo Santos
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, Strings
Prabu U
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
Ashim Lamichhane
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
Coding
CodingCoding
Coding
Vishal Singh
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan ppt
george1616
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
Faiza Gull
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02Terry Yoast
 
Cs111 ch01 v4
Cs111 ch01 v4Cs111 ch01 v4
Cs111 ch01 v4
ArnoldNarte
 
Principles of programming
Principles of programmingPrinciples of programming
Principles of programming
Rob Paok
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
Yanne Evangelista
 
Logic Formulation 3
Logic Formulation 3Logic Formulation 3
Logic Formulation 3
deathful
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2
ITNet
 
Cp 111 lecture 2
Cp 111 lecture 2Cp 111 lecture 2
Cp 111 lecture 2
HafidhyMasoud
 

What's hot (20)

POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Program logic formulation
Program logic formulationProgram logic formulation
Program logic formulation
 
Program Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State UniversityProgram Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State University
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, Strings
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Coding
CodingCoding
Coding
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan ppt
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
 
Cs111 ch01 v4
Cs111 ch01 v4Cs111 ch01 v4
Cs111 ch01 v4
 
Principles of programming
Principles of programmingPrinciples of programming
Principles of programming
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
 
Logic Formulation 3
Logic Formulation 3Logic Formulation 3
Logic Formulation 3
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2
 
Cp 111 lecture 2
Cp 111 lecture 2Cp 111 lecture 2
Cp 111 lecture 2
 

Similar to Comp102 lec 1

Chapter 01.PPT
Chapter 01.PPTChapter 01.PPT
Chapter 01.PPT
JoeBlack136
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentals
SasidharaRaoMarrapu
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
MIT,Imphal
 
Week10 final
Week10 finalWeek10 final
Week10 final
Irfan Ali Memon
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
shoaibkhan716300
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
MMRF2
 
chapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdfchapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdf
BernardVelasco1
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
Seble Nigussie
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
mohd_mizan
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow charts
Chinnu Edwin
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
umardanjumamaiwada
 
lecture 5
 lecture 5 lecture 5
lecture 5
umardanjumamaiwada
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
Appili Vamsi Krishna
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)
Dr. Ahmed Al Zaidy
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
DivyaKS12
 
Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycle
Dhana malar
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p
 

Similar to Comp102 lec 1 (20)

Chapter 01.PPT
Chapter 01.PPTChapter 01.PPT
Chapter 01.PPT
 
Pj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentalsPj01 1-computer and programming fundamentals
Pj01 1-computer and programming fundamentals
 
L1
L1L1
L1
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
chapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdfchapter1-161229182113 (1).pdf
chapter1-161229182113 (1).pdf
 
Chap1
Chap1Chap1
Chap1
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow charts
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Debbuging
DebbugingDebbuging
Debbuging
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycle
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 

More from Fraz Bakhsh

More from Fraz Bakhsh (10)

Comp102 lec 10
Comp102   lec 10Comp102   lec 10
Comp102 lec 10
 
Comp102 lec 9
Comp102   lec 9Comp102   lec 9
Comp102 lec 9
 
Comp102 lec 8
Comp102   lec 8Comp102   lec 8
Comp102 lec 8
 
Comp102 lec 7
Comp102   lec 7Comp102   lec 7
Comp102 lec 7
 
Comp102 lec 6
Comp102   lec 6Comp102   lec 6
Comp102 lec 6
 
Comp102 lec 5.1
Comp102   lec 5.1Comp102   lec 5.1
Comp102 lec 5.1
 
Comp102 lec 5.0
Comp102   lec 5.0Comp102   lec 5.0
Comp102 lec 5.0
 
Comp102 lec 4
Comp102   lec 4Comp102   lec 4
Comp102 lec 4
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
 
Comp102 lec 11
Comp102   lec 11Comp102   lec 11
Comp102 lec 11
 

Comp102 lec 1

  • 1. 1 COMP 102: PROGRAMMING I SPRING 2012 Material is based on *Programming Logic and Design, Fifth Edition, Comprehensive Chapter 1 * Introduction to Programming in C++: Algorithms,Flowcharts and Pseudocode by Brent Daviduck
  • 2. Course Outline Instructor Information: Name Ms. Saira Anwar Email SairaAnwar@fccollege.edu.pk SairaAnwar@hotmail.com Office S – 211 Office Hours Monday, Wednesday 10:00 – 11:00 Tuesday, Thursday 11:00 – 12:00 Class Meet Tuesday, Thursday 9:00 – 10:50 AM Category •Core course for all Computing Majors •Recommended General Education Course for students with some enthusiasm to learn programming and who want to feel real flavor of writing a program Pre- Requisite Nil Website https://sites.google.com/site/comp102seca/
  • 3. Course Outline  Text Book  Java in Two Semesters by Quentin Charatan and Aaron Kans  Java 6 Illuminated Second Edition By Julie Anderson, Herve Franceschi  Reference Books  Art and Science of Java by Eric Roberts  Thinking in Java, by Bruce Eckel  Java, The Complete Reference, by Patrick Naughton, Herbert Schildt  Java and Object Orientation: An introduction, John Hunt  The Java Handbook , by Patrick Naughton, Michael Morrison  Java in a Nutshell: A Desktop Quick Reference for Java Programmers , by David Flanagan  The Java Language Specification , by James Gosling , Bill Joy, Guy Steele  Who's Afraid of Java?, by Steve Heller
  • 4. Course Outline Grading: Lab Quiz (Consider them 45% exams) Assignments and Quiz 7% Project 7% Group Quiz 1% Mid (Out of class) 20% Final 20% Total 100.00% •REGRADING CAN BE REQUESTED WITHIN FOLLOWING TIME LIMITS: QUIZZES AND HOMEWORKS: 2DAYS, EXAMS: 3DAYS
  • 5. Course Outline Attendance and Quiz Policy: •Attendance in class is mandatory. •Inadequate attendance (less than 85%) may lead to disqualification from the Midterm and/or Final Exams. •Take attendance on random days. •There could be both announced and un- announced quizzes •Deadlines are hard deadlines.
  • 6. Course Outline Academic Honest: •What is plagiarism? “Plagiarism is defined as presenting someone else’s work as your own. Work means any intellectual output, and typically includes text, data, images, sound or performance.” (Office of Academic Appeals & Regulation 2005) Office of Academic Appeals & Regulation, 2005, Section 2.1 of the published procedures on “ Cheating, plagiarism and fraudulent or fabricated coursework ” (available online at http://www.leeds.ac.uk/AAandR/cpff.htm - accessed 6th Aug 2005)
  • 7. Course Outline Plagiarism is serious: •All cases are reported and go on your student record. •Penalties vary from written warnings, re- sitting modules to expulsion from the University. •Why? – plagiarism undermines the University’s reputation and the quality of its degrees and research, plus plagiarists miss out on learning!
  • 8. Course Outline Plagiarism Detection: •Subject experts knowledge of the discipline and its literature. •Changes in writing style, inappropriate writing style. •Electronically.
  • 9. Course Outline References: •“Write the text taken from others in double quotes and italicize the text. Put referencec at the end.”[1]. •If your ideas match to someone put references [2]. •If you want to put multiple references. Put them like it [3][4][5][6]. •You have to double quote the major terms like “Software Engineering”.
  • 10. Course Outline “The only stupid question is the one which is never asked”[Unknown]
  • 11. Good programmers can rule the kingdom ! 11
  • 12. Understanding Computer Components and Operations 12  Hardware and software: the two major components of any computer system  Hardware: equipment, or devices  Software: programs that contain instructions for the computer  Four major operations in a computer:  Input  Processing  Output  Storage
  • 13. Program Input (Data) PROGRAM Output (Results) (Algorithm) 13 Takes some values as INPUT PROCESS Them Produce some result as OUTPUT
  • 14. Programming Task 14  A typical programming task can be divided into two phases:  Problem solving phase  produce an ordered sequence of steps that describe solution of problem  this sequence of steps is called an algorithm  Implementation phase  implement the program in some programming language
  • 15. Understanding Computer Components and Operations 15  Input devices: allow data to enter the computer  Mouse, keyboard, scanner  Processing: working on the data  Organizing data  Checking data for accuracy  Mathematical or other manipulations on data  Central Processing Unit (CPU): hardware that performs the tasks
  • 16. Understanding Computer 16 Components and Operations  Output devices: provide data to the user  Printer, monitor, speakers  Programming language: special language containing instructions for the computer  Visual Basic, Java, C#, C++, COBOL  Syntax: rules governing word usage and punctuation in the language
  • 17. Understanding Computer 17 Components and Operations  Machine language: controls the computer’s on/off circuitry  Compiler or interpreter: software that translates programming languages to machine language  Program must be free of syntax errors to be run, or executed, on a computer  To function properly, the logic must be correct  Algorithm = Syntax + Semantics
  • 18. Understanding 18 the Programming Process  Six programming phases:  Understand the problem  Plan the logic  Code the program  Use software to translate the program to machine language  Test the program  Put the program into production
  • 19. Understanding the Problem 19  May be the most difficult phase  Users may not be able to articulate their needs well  User needs may be changing frequently  Programmers may have to learn the user’s functional job tasks  Failure to understand the problem is the major cause of most project failures
  • 20. Planning the Logic 20  Plan the steps that the program will take  Use tools such as flowcharts and pseudocode  Flowchart: a pictorial representation of the logic steps  Pseudocode: Natural language representation of the logic  Walk through the logic before coding by desk- checking the logic
  • 21. Pseudo Code and Flow Charts 21  Pseudo Code  Algorithms written in structural English  Good way to begin a solution design  Program flow is not always clear  Flow Charts  Graphical representation  Express flow of control
  • 22. Using Software to Translate the Program into Machine Language 22 Creating an executable program
  • 23. Points to Note: 23 1. The process consists of repeated application of simple steps 2. All steps are unambiguous (clearly defined) 3. We are capable of doing all those steps 4. Only a limited no. of steps needs to be taken 5. Once all those steps are taken according to the prescribed sequence, the required result will be found 6. Moreover, the process will stop at that point
  • 24. 24 Constructs Basic Programming Tools
  • 25. Sequence/ Sequential Execution  Unconditional Transfer  Input or output  Processing 25
  • 26. Branching  Conditional Transfer ?? 26
  • 27. Loops  Conditional Loop  Counted Loop 27
  • 29. Flowcharts for three constructs 29
  • 30. Using Flowchart Symbols and 30 Pseudocode Statements
  • 32. Elements of Flowcharts 32 Symbol Name Flowline Terminal Input/Output Processing Decision
  • 33. Continued… 33 Symbol Name Connector Off page Connector Predefined process Annotation
  • 38. What is a flowchart?  Flowcharts are one method for creating an Algorithm.  They allow a process to be described in a step-by-step manner.  Other Algorithm types are Pseudocode and Prose.
  • 39. Terminators Start  Oval Shape  One line in or out  Used to indicate the beginning and end of a process Stop
  • 40. Data Boxes  Parallelogram shaped Input  One line in, One line out  Used to indicate the input or output of data from the system. Output
  • 41. Process Boxes  Rectangle shaped  One line in, One line out  Used to indicate a process step Process
  • 42. Decision Boxes  Diamond shaped  One line in, two lines out  Must contain a binary Yes/No question (Yes/No, Question True/False, 0/1, etc)  Used to branch a program dependent upon a condition being met
  • 43. Subprocess Box  Rectangle shaped, with bars on the sides  One line in, One line out Subprocess  Used to include a predefined process
  • 44. Bad design…  What is wrong with this chart?  The box has two lines in, one line out…  Lines must join other lines, never boxes!
  • 45. Bad design…  What is wrong with this flowchart?  Never use curved lines.  Always straight  Always vertical or horizontal.
  • 46. Remember…  Drawing flowcharts is actually easy.  Breaking tasks into small steps is often much harder than it might seem.  If you can flowchart it, you can program it.
  • 47. Flowchart Conversion from Fahrenheit-to- Celsius 47
  • 48. Flowchart for Computing sum, product and average 48 Start Start Prompt the user and get Prompt the user and get number1 and number2 number1 and number2 sum = number1 + number2 sum = number1 + number2 product = number1 **number2 product = number1 number2 average =sum/2 average =sum/2 Print sum, product and average Print sum, product and average End End
  • 49. Flowchart for Computing circumference and area of a circle 49 Start Start Prompt the user and Prompt the user and get radius of the circle get radius of the circle circumference = 2*3.14*radius circumference = 2*3.14*radius Area = 3.14*radius*radius; Area = 3.14*radius*radius; Print circumference and Print circumference and area of the circle area of the circle End End
  • 50. Flowchart for Computing min and max of 2 numbers 50 Start Start Prompt the user and get number1 and number2 Prompt the user and get number1 and number2 yes number1 < number2 ? number1 < number2 ? no min = number1 min = number1 min = number2 min = number2 max = number2 max = number2 max = number1 max = number1 Print min and max Print min and max End End
  • 51. Flowchart : Computing min of 3 numbers 51 Start Start Prompt the user and Prompt the user and get number1, number2 and number3 get number1, number2 and number3 yes number1 < number2 ? number1 < number2 ? no yes yes number2 < number3 ? number2 < number3 ? number1 < number3 ?? number1 < number3 no no min = number3 min = number3 min = number2 min = number2 min = number3 min = number3 min = number1 min = number1 Print min Print min End End
  • 52. Flowchart Computing min of 3 numbers 52 Start Start Prompt the user and Prompt the user and get number1, number2 and number3 get number1, number2 and number3 min = number1 min = number1 yes number2 < min? number2 < min? no min = number2 min = number2 yes number3 < min? number3 < min? no min = number3 min = number3 Print min Print min End End