Download presentation
Presentation is loading. Please wait.
Published byCuthbert Collins Modified over 9 years ago
1
Introduction to Programming Design School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 1, Friday 01/17/2003) (Continued)
2
2 Learning Objectives n Distinguish between Procedure-oriented programming and Event-driven programming n Name the three basic control structures of structured programming
3
3 Programming languages English Machine Language Programming languages: Procedural languages 4GL languages Event-driven prog. languages Object-Oriented languages
4
4 Procedural language n Requires programmer to code specific steps in problem-solving process n Example: COBOL, PASCAL, BASIC PRINT "Enter a Fahrenheit temperature:" INPUT FARENHT CELSIUS = (FARENHT - 32) * 5 / 9 PRINT "The Fahrenheit temperature is "; FARENHT PRINT "The Celsius temperature is "; CELSIUS END
5
5 Event-driven programming languages n Respond to actions (events) that occur when the program is running n Events initiated by the computer or by the user n Programmer design logic associated with events n Example of Event-driven programming language: Visual Basic Private Sub btnOK_Click () Amount = Val (txtAmount.text) Taxe = Amount * 0.06 End Sub
6
6 Structured programming n Based on computer’s ability to: – Execute instructions in a step-by-step manner – Make decisions – Repeat instructions n Problem solving using 3 basic patterns of logic n Basic Control structures: – SIMPLE SEQUENCE Control structure – IFTHENELSE Control structure – DOWHILE Control structure
7
7 SIMPLE SEQUENCE Control structure n Represent computers’ ability to execute instructions in a step-by-step (sequential) manner 1. Proceed down Main Street for two miles. 2. Turn left on Ocean Drive. 3. Proceed on Ocean Drive for three blocks, to the fork. 4. At the fork, take Swan Street to the left. 5. Proceed two blocks. 6. House is second on the left (246 Swan Street) Figure 1-9 Simple Sequence: An Example
8
8 IFTHENELSE Control structure n Represent computers’ ability to make decisions 4. IF left turn at fork is blocked THEN Take right turn at fork onto Eagle Street. Proceed five blocks. Turn left at Clifton Avenue. Proceed three blocks. Turn left at Circle Drive. Proceed two blocks. Turn left at Swan Street. House is fourth on the right (248 Swan Street). ELSE At the fork, take Sawn Street to the left. Proceed two blocks. House is second on the left (248 Swan Street) ENDIF Figure 1-10 IFTHENELSE : An Example
9
9 DOWHILE Control structure n Represent computers’ ability to repeat instructions n A series of repeated instructions is called a loop Figure 1-13 DOWHILE: An Example DOWHILE hair is not clean Wash hair Rinse hair ENDDO
10
10 Summary Questions 1. What does it mean to say that a language is procedure-oriented ? 2. (a) Give an example of a procedural language. (b) Give an example of a event-driven programming language. 3. What is meant by Event-driven programming? 4. Name the 3 basic control structures of structured programming
11
11 1. Analyze the current system 2. Define the new system requirements 3. Design the new system 4. Develop the new system 5. Implement 6. Evaluate the new system System Development Life Cycle 4.1. Review the input, processing, output and storage requirements 4.2. Develop the logic for the program 4.3. Write the program using a programming language 4.4. Test and debug the program 4.5. Complete the program documentation
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.