1 / 39

CHAPTER 2

CHAPTER 2. SOFTWARE DEVELOPMENT METHOD. Objectives. In this chapter you will learn: The electronic computers and its’ suitable programming language To solve problem using problem-solving strategies and methods The algorithm as a guidance in designing program. Subtopics.

Download Presentation

CHAPTER 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 2 SOFTWARE DEVELOPMENT METHOD

  2. Objectives In this chapter you will learn: • The electronic computers and its’ suitable programming language • To solve problem using problem-solving strategies and methods • The algorithm as a guidance in designing program

  3. Subtopics • Electronic Computers • Introduction to Programming • Software Development Method (SDM) • Algorithm Design

  4. Electronic Computers What is computer ? • A computer is an electronic device designed to perform operations specified with a set of instructions called a program. • A computer include both hardware & software

  5. Why we need computers ? The use of Computer in daily activities • bill payment, booking transportation ticket, communication services, e-mailing friends, on-line communication, subject registration, course assessments & etc. As for engineering students, you should develop the ability to solve problems, and it is very likely that you will need to use computers for problem solving

  6. BEC 10102 SEM 1 2010/2011 Computer Hardware (1) Major hardware components : • Central Processing Unit (CPU) • Control unit (CU) & Arithmetic/Logic Unit (ALU) • Memory (main memory) • Storage Devices (disks, CDs, tapes) • Input/Output Devices (monitors, keyboards, mice, printers • Communication Devices (modems and network interface cards (NIC cards) Note : The components are connected through a subsystem called a bus that transfers data between the components. (Source : Y.D. Liang “Introduction to Programming with C++”, Comprehensive Version. International Edition. Pearson Education, 2007)

  7. BEC 10102 SEM 1 2010/2011 Computer Hardware (2) HARDWARE = PERIPHERAL EQUIPMENT + CENTRAL/SYSTEM UNIT

  8. Computer Software • Operating System (OS) • Unix, Window, Linux • Software Tools (Utility Packages) • word processors (MicrosoftWord, WordPerfect) • spreadsheet programs (Excel, Lotus1-2-3, ...) • Computer Languages/ Programming Languages • machine language • assembly language • binary language • high level languages (C, C++, Ada, Fortran, Basic, java) • User Developed Programs • SMAP On-Line • MayBank2you

  9. BEC 10102 SEM 1 2010/2011 Intro to Programming Programming is the core of everything to do with computers, computing, networked systems, management information systems, multimedia and so on (all computer-based things) Everything that runs on a computer is a program and somebody (programmer) has to write it using specific programming language. To understand how computers can be used, how applications work, how systems are configured, it is necessary for you to understand what programs are and how they are constructed.

  10. Software Development Method (SDM) What is Problem Solving@Solution ? The process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and by relying on our ability to select and useappropriate problem-solving strategies, techniques, and tools.

  11. SDM Phases • provides us with a precise definition of the problem. • we identify problem inputs, outputs, constraints, and formulas and equations to be used. • concerned with developing an algorithm (subtopic 1.4)for the solution of the problem.

  12. SDM : Coding & Implementation • Code the finalized algorithm using a suitable programming language. • Go through the compiling & executionprocess. • Normally, you will face this three types of programming errors • Logic/Design errors • Syntax errors • Runtime errors

  13. Logic/Design errors • Design errors occur during the analysis, design, and implementation phases. • We may choose an incorrect method of solution for the problem to be solved, we may make mistakes in translating an algorithm into a program, or we may design erroneous data for the program. • Design errors are usually difficult to detect. • Debugging them requires careful review of problem analysis, algorithm design, translation, and test data.

  14. Syntax Errors • Syntax errors are violations of syntax rules, which define how the elements of a programming language must be written. • They occur during the implementation phase and are detected by the compiler during the compilation process. In fact, another name for syntax errors is compilation errors. • If your program contains violations of syntax rules, the compiler issues diagnostic messages. • Depending on how serious the violation is, the diagnostic message may be a warning message or an error message.

  15. Runtime Errors • Run-time errors are detected by the computer while your program is being executed. • They are caused by program instructions that require the computer to do something illegal, such as attempting to store inappropriate data or divide a number by zero. • When a run-time error is encountered, the computer produces an error diagnostic message and terminates the program execution. • You can use diagnostic messages to debug run-time errors.

  16. BEC 10102 SEM 1 2010/2011 SDM : Testing and Verification • Testing the completed program to verify that it works as desired. • Do not rely on just one test case. • Run the program several times using different sets of data to make sure that it works correctly for every situation provided in the algorithm.

  17. SDM : Documentation & Maintenance For every problem solving, there are 5 things to be documented : • Program description • Algorithm development and changes • Well-commented program listing • Sample test run • User’s manual Maintenance is concerned with ongoing correction of problems, revision to meet changing needs and addition of new features. The better the documentation is, the efficiently this phase can be performed.

  18. Algorithm Design • An algorithm is a sequence of a finite number of steps arranged in a specific logical order that, when executed, produces the solution for a problem. • An algorithm design should be put on paper. For this purpose, and also to facilitate its development, we resort to pseudocoding and flowcharting

  19. Analogy A) How to use ATM Machine ? i. Step 1 ? ii. Step 2 ? ………. x. Final step ? B) How to register courses using SMAP on-line ?

  20. Pseudocoding Short English phrases with a limited vocabulary are use to describe the algorithm (the processing steps). A pseudocode must : • have a limited vocabulary • be easy to learn • produce simple, English-like narrative notation • be capable of describing all algorithms, regardless of their complexity

  21. Example of Pseudocode Problem 1 : (Sequence structure) Compute total of resistor values. Begin read resistor1, resistor2 total = resistor1 + resistor2 print “ total “ End

  22. Flowcharting A graphical technique for algorithm design and representation, is equivalent to pseudocoding and can be used as an alternative to it.

  23. Flowchart Symbols (1)

  24. Flowchart Symbols (2)

  25. Example of Flowchart Problem 1 : (Sequence statements) Compute total of resistor values.

  26. Pseudocode & Flowchart Convention • Sequence Structure • a series of steps or statements that are executed in order (ex : as shown in Problem 1) • Selection Structure • Define two courses of action depending on the outcome condition ( true or false) • Repetition control structures • Specifies a block of one or more statements that are repeatedly executed until a condition is satisfied.

  27. Sequence Structure begin Statement_1 Statement_2 … Statement_n end

  28. BEC 10102 SEM 1 2010/2011 Selection Structure • Single Selection (if) if condition statement • Double Selection (if-else) if condition then_part else else_part end_if

  29. BEC 10102 SEM 1 2010/2011 Repetition Structure while condition loop-body end_while

  30. Applying the SDM ( Phase 1 to 3) Problem : The C programming test scores can be classified into two condition, PASS and FAIL. The student is require to input their marks in positive integer . If the score is greater than or equal 50 message Pass will appear, message Fail otherwise

  31. Applying the SDM : Phase 1 & 2 Phase 1 : Requirement Specification • Selection Structure • test scores, message ‘PASS’, message ‘FAIL’, greater or equal to 50, less than 50 Phase 2 : Data requirements : Input : test_score Output : ‘PASS’ or ‘FAIL’ Relevant formula : None Constrain : the test score must greater than 0 (zero) Condition : test_score >= 50 test_score < 50

  32. BEC 10102 SEM 1 2010/2011 Applying the SDM : Phase 3 (1) Phase 3 : Design ( Pseudocode/Flowchart) • Pseudocode Begin Read the test scores Begin while while test_score < 0 Print ‘ Re-enter your score and must greater than 0’ Read the test_score End while if test_score >= 50 print ‘PASS’ else print ‘FAIL’ End

  33. BEC 10102 SEM 1 2010/2011 Applying the SDM : Phase 3 (2) • Flowchart

  34. Exercises • Write an algorithm (Pseudo code and flow chart) for attending a lecture • Write an algorithm that calculate the multiplication of two integer numbers. • Write an algorithm which can determine the positive and negative integer. • Write an algorithm that can print series of odd numbers between 0 and 12.

  35. Start Wake Up Take Shower Get Dressed Eat Breakfast Has Transport N Walk to Lecture hall Y Late? Y Go back home Take Transport N End Enter Class

  36. Begin Wake up Take shower Get dressed Eat breakfast If has transport take transport Else walk to lecture hall If late go back home Else enter class end

  37. Begin int w; int l; int area; w=20; l=25; area=w*l print “Your area is “ print area end

  38. Write a program to calculate the square area. Print area • Design a Program that a salesperson gets 6 percent commission on sales less than $1000, 8 percent on sales in the range $1000 through $2000, and 10 percent on sales in excess of $2000. Print the commission.

  39. Write a program that can read age. Print “young” if the age less than 20, print “Adult” if the age between 20 to 30 and print “old” if the age above 30.

More Related