Lesson - 2. Introduction When we make a program we must follow some steps, called Programming Development Life Cycle (PDLC). Programming steps are five:

Slides:



Advertisements
Similar presentations
Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
Advertisements

Chapter 1: An Overview of Computers and Programming Languages
LECTURE 1 CMSC 201. Overview Goal: Problem solving and algorithm development. Learn to program in Python. Algorithm - a set of unambiguous and ordered.
Solving Quadratic Equations Algebraically Lesson 2.2.
COSC 120 Computer Programming
Computer Science 1620 Variables and Memory. Review Examples: write a program that calculates and displays the average of the numbers 45, 69, and 106.
Program Flow Charting How to tackle the beginning stage a program design.
Computer Programming 1 Problem Solving and Software Engineering.
Computer Science 1620 Programming & Problem Solving.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages Updated by: Dr\Ali-Alnajjar.
Software Engineering 1 (Chap. 1) Object-Centered Design.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Solving Quadratic Equations Section 1.3
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
1 Programming and Problem Solving — Software Engineering (Read Chap. 2)
Programming and Problem Solving — Software Engineering (Read Chap. 2) 1.
Problem Solving and Software Engineering Chapter 1.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Programming Lifecycle
Program Development Life Cycle (PDLC)
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
1 Conditions Logical Expressions Selection Control Structures Chapter 5.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
Overview of Programming and Problem Solving Textbook Chapter 1 1.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Fundamental Programming: Fundamental Programming Introduction to C++
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
1 Original Source : and Problem and Problem Solving.ppt.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
CHAPTER 2 PART #3 C++ INPUT / OUTPUT 1 st Semester King Saud University College of Applied studies and Community Service CSC1101 By: Fatimah.
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
PROGRAMMING. Computer Programs  A series of instructions to the computer  pre-written/packaged/off-the-shelf, or  custom made  There are 6 steps to.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING LIFE CYCLE. GROUP NAME:  RABIATUL ADAWIYAH BINTI MOHD NOOR 18ENS14F2001  KHAIRULAMIN ZAQUAN BIN AZHAM FUAD 18DNS14F2019  MUHAMMAD NAIM.
Basic concepts of C++ Presented by Prof. Satyajit De
Introduction to Computers and C++ Programming
Chapter 1: An Overview of Computers and Programming Languages
Completing the Problem-Solving Process
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Understand the Programming Process
Chapter 1: An Overview of Computers and Programming Languages
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Understand the Programming Process
Chapter 1: An Overview of Computers and Programming Languages
Life is Full of Alternatives
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Chapter 1 c++ structure C++ Input / Output
Presentation transcript:

Lesson - 2

Introduction When we make a program we must follow some steps, called Programming Development Life Cycle (PDLC). Programming steps are five: 1. Formulate the Problem 2. Design the Solution 3. Code the Program (Implement the Solution) 4. Test the Program 5. Document and Maintain

Example Problem Make a program which asks the constants a, b, c and finds the roots of second degree equation.

1. Formulate the Problem What is this program supposed to do? It should finds the roots of second degree equation ax 2 + bx +c =0 What kind of information is it given? (What is the input?) Constants a,b and c are given by keyboard. What kind of results is it to produce? (What is the output?) The output are roots x1 and x2

1. Formulate the Problem What formulas or techniques will be needed? Find the Discriminant Δ=b 2 -4ac Find the Roots If Δ > 0 then where If Δ = 0 then where Else there are not real roots. and

2. Design the Program Designing the overall structure of the program to solve the problem. Design the Algorithm of program.

2. Design the Program The algorithm of our problem will be: 1. Start 2. Read a, b and c constants 3. Calculate the Discriminat Δ=b 2 -4ac 4.If Δ > 0 Then 4.1 Calculate and 4.2 Display x 1 and x 2 4.3Else If Δ = 0 Then Calculate x1=x2=-b/2*a 4.3.2Display x 1 or x Else Display Message “There aren’t Real Roots” 5. End

3. Code the Program After the program has been designed it must be coded or written in a programming language to be translated in a language that computer can understand. Code the program in appropriate programming language following the syntax carefully.

3. Code the Program # include using namespace std; int main () { int a,b,c; float d, x1, x2; cout << "Enter the constants a,b and c"<<endl; cin >> a >>b >>c; d=b*b-4*a*c; if (d>0) { x1=(-b+sqrt(d))/2*a; x2=(-b-sqrt(d))/2*a; cout<<"Roots of this equation are: " << x1 <<" and " <<x2 <<endl; } else if (d=0) { x1=-b/2*a; cout<<"Roots of this equation are equal and they are: " << x1 <<endl; } else { cout<<"This equation doesn't have real roots" <<endl; } system("pause"); return 0; }

4. Test the Program Compiling is the process of translating the human code (written code) into binary language (machine language). When we compile the code we will check errors. There are two main types of errors: syntax errors logic errors.

4. Test the Program Syntax errors are problems with grammar, spelling, or punctuation. If you have left off a semi colon or added one where you shouldn’t have or misspelled a reserve (key) word, these are all syntax errors. These are the easiest ones to find because the program itself helps you to find them.

4. Test the Program Logic errors are errors that make a program’s results incorrect. These are much more difficult to find. No compiler will stop and tell you that you have a logic error. The programmer, need to find the logic errors by yourself.

5. Document and Maintain To Document is to put together all of the materials that have been generated throughout the PDLC process. All of the flowcharts, messages, algorithms, lines of code, and the user manuals are part of this documentation. There are two types of documentation: Internal documentation External documentation

5. Document and Maintain To maintain is to make sure that the program keeps running as it should and to do any needed updating or fixing. Maintenance is the longest phase of the PDLC. As users use the program, they will notice things that need to be fixed or updated.

Thank you!