COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.

Slides:



Advertisements
Similar presentations
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Advertisements

Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Algorithms and Problem Solving
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
INTRODUCTION TO PROGRAMMING
Overview. What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP.
ITEC113 Algorithms and Programming Techniques
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
Chapter 2- Visual Basic Schneider
Problem Solving and Program Design Programming. COMP104 Lecture 3 / Slide 2 Problem Solving Process l Define and analyze the problem. l Develop a solution.
Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 2: Algorithm Discovery and Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Algorithm & Flowchart.
COS120 Software Development Using C++ AUBG Fall semester 2010
1 INF110 Visual Basic Programming AUBG Spring semester 2011 Reference books: Schneider D., An Introduction to Programming Using Visual Basic, Prentice.
Chapter 2: Problem Solving
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Chapter 2: Problem Solving
CS 0004 –Lecture 8 Jan 24, 2011 Roxana Gheorghiu.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman CPCS 202 Chapter 2 – Input/Output
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Lifecycle
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
© 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.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Chapter 2: General Problem Solving Concepts
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.
Basic problem solving CSC 111.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 1 Monday 29 Sept 2014 EGR 115 Introduction to Computing for Engineers.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
The Hashemite University Computer Engineering Department
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Programming Fundamentals Introduction to Problem Solving  Programming is a problem solving activity. When you write a program, you are actually writing.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Management Information System Section (211 NMA course) Introduction to Programming.
ICS 3UI - Introduction to Computer Science
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Chapter 2- Visual Basic Schneider
CS1001 Programming Fundamentals 3(3-0) Lecture 2
Lecture 2 Introduction to Programming
Introduction to Problem Solving
Chapter 2- Visual Basic Schneider
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
Basic Concepts of Algorithm
Presentation transcript:

COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot Koffman, Course lecturer: Assoc. Prof. Stoyan Bonev, PhD

Lecture 3: Introduction to Computers, Problem Solving and Programming (continued)

3 Lecture Contents: t Software Development Method (Software Life Cycle) – reminder and further explanations; t Applying the SDM for solving problems based on linear and branch algorithms; t Introduction to loop algorithms.

4 Software Development Method – Software Life Cycle – Program Development Cycle Version 1:  Specify the problem requirements;  Analyze the problem;  Design the algorithm to solve the problem;  Implement the algorithm;  Test and verify the completed program;  Maintain and update the program.

5 Software Development Method – Software Life Cycle – Program Development Cycle Version 2:  Systems Analysis;  Systems Design;  Systems Implementation;  Systems Support.

6 Software Development Method – Software Life Cycle – Program Development Cycle Version 3: –Analyze: Define the problem –Design: Plan the solution to the problem –Choose the interface: Select text boxes, buttons, etc –Code: Translate the algorithm into a Prog Lan like C/C++ or C# or Java or VBasic –Test & Debug: Locate and remove any errors in program –Complete documentation: Organize program description

7 Software Development Method t Problem Analysis - (Correct Problem) –Identify data objects –Determine Input / Output data –Constraints on the problem t Design –Decompose into smaller problems –Top-down design (Divide and Conquer) –Develop Algorithm (Desk Check)

8 Software Development Method t Implementation –Writing the algorithm t Testing –Verify the program meets requirements –System and Unit test t Documentation –Key part in the development process

9 Algorithm definitions Definition 1: A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Definition 2: A procedure for solving a problem in terms of 1. the actions to be executed, and 2. the order in which these actions are to be executed is called an algorithm. Definition 3: An algorithm is a list of steps for solving a problem.

10 Design Notations Three “notations” used to document algorithms: Flowchart Pseudo code Hierarchy chart

11 Applying the Software Development Method Attention: Analyze the problem and design the algorithm: It is helpful to underline phrases in the problem statement that identify input and output.

12 Exercise 3.1 Apply the SDM and build a linear algorithm: Problem: t To convert Celsius degrees to Fahrenheit degrees Fahr = 9/5 * Cel + 32 or t To convert Fahrenheit degrees to Celsius degrees Cel = 5/9 * (Fahr – 32)

13 Exercise 3.2 Apply the SDM and build a linear algorithm: Problem: To evaluate in dollars and cents a collection of coins using the formula TotalCents = 25*Quarters + 10*Dimes + 5*Nickels + Pennies; Dollars = TotalCents / 100; Change = TotalCents % 100; or Change = TotalCents–Dollars*100;

14 Exercise 3.3 Apply the SDM and build a linear algorithm: Problem: To compute the area and circumference of a circle (or 3 circles) area: s = π * rad * rad circumference: p = 2 * π * rad π constant is = 3.14 (more precisely π constant is = … )

15 Exercise 3.4 Apply the SDM and build a branch algorithm: Problem: To compute the area of a triangle using the Heron’s formula dealing with area s = ( p*(p-a)*(p-b)*(p-c) ) 1/2 where a, b and c are the triangle sides and p is half the perimeter p=(a+b+c)/2

16 Exercise 3.5 Apply the SDM and build a branch algorithm: Problem: To display a menu like 1. Rectangle 2. Square 3. Triangle 4. Circle Enter your choice (1-4)? and depending on the option selected to compute and display the area and perimeter of a rectangle, or a square, or a triangle, or a circle.

17 Repetition/Iteration/ (Intro to loop algorithms) Specific problem solving requirements: one, two or more process activities are to be executed zero, one, two or more times. How to build such an algorithm? –Exhaustively enumerating all activities OR –Using a loop algorithm

18 Remark t Introducing the concept of an accumulator –To save sum (result of many additions) Initial value –To save product (result of many multiplications) Initial value

19 Exercise 3.6 Apply the SDM and build a loop algorithm: Problem: To compute the Sum of a series of successive numbers 1, 2, 3, 4, 5 How to solve the problem? See next slide

20 Hint: 3 possible solutions Solution A:S = ================================================================================== Solution B:. ================================================================================== Solution C:.

21 Hint: 3 possible solutions Solution A:S = ================================================================================== Solution B:S = 0 S = S + 1 S = S + 2 S = S + 3 S = S + 4 S = S + 5 ================================================================================== Solution C:.

22 Hint: 3 possible solutions Solution A:S = ================================================================================== Solution B:S = 0 S = S + 1 S = S + 2 S = S + 3 S = S + 4 S = S + 5 ================================================================================== Solution C:S = 0 S = S + I, where I=1,5, step +1

23 Exercise 3.6 Apply the SDM and build a loop algorithm: Problem: To compute the Sum of a series of successive numbers 1, 2, 3, 4, 5, … n

24 Exercise 3.7 Apply the SDM and build a loop algorithm: Problem: To compute the Product of a series of odd numbers 1, 3, 5, 7, … n

25 Exercise 3.8 Apply the SDM and build a loop algorithm: Problem: To compute 5 Pythagorean triples using two integers m and n (m>n) as input and applying following formulas to compute all the 3 sides of a right triangle: side 1 = m 2 –n 2 ;side 2 = 2*m*n; hypotenuse = m 2 +n 2

26 Thank You For Your Attention!