Chapter One Problem Solving

Slides:



Advertisements
Similar presentations
CS 240 Computer Programming 1
Advertisements

Prof. B. I. Khodanpur HOD – Dept. of CSE R. V. College of Engineering
UNIT 2. Introduction to Computer Programming
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Reference :Understanding Computers
CS 240 Computer Programming 1
Algorithms and flow charts
Chapter 1 Pseudocode & Flowcharts
INTRODUCTION TO PROGRAMMING
Al-Karma Language School Computer Department Prep. 3.
Chapter 2- Visual Basic Schneider
Program Flow Charting How to tackle the beginning stage a program design.
Developing logic (Examples on algorithm and flowchart)
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
Review Algorithm Analysis Problem Solving Space Complexity
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Algorithm & Flowchart.
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithm – part one Jennifer Elmer Form 3 Computing.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Concepts Chapter 3.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Software Life Cycle What Requirements Gathering, Problem definition
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
Chapter 2: General Problem Solving Concepts
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Basic problem solving CSC 111.
Chapter 1 Pseudocode & Flowcharts
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
PROBLEM SOLVING. What is a Problem? A problem is a situation that needs to be resolved.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Chapter 1 Introduction 2nd Semester H
Chapter One Problem Solving
Introduction to Programming / chapter 3 / COM1022
Problem , Problem Solving, Algorithm & Flow Charts –Part 1
Chapter 2: Input, Processing, and Output
Chapter 2- Visual Basic Schneider
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Algorithms and Flowcharts
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Lecture 2 Introduction to Programming
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Numbering System TODAY AND TOMORROW 11th Edition
Introduction to Algorithm – part 1
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
ALGORITHMS AND FLOWCHARTS
Chapter 1 Pseudocode & Flowcharts
Unit# 9: Computer Program Development
PROBLEM SOLVING CSC 111.
Pseudocode & Flowcharts
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithms and Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Software Development Process
Basic Concepts of Algorithm
Chapter 1 Pseudocode & Flowcharts
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Programming Logic and Design Eighth Edition
Presentation transcript:

Chapter One Problem Solving Objectives: 1- Understand what is “ Programming”? 2- Define “Problem” & “ Problem Solving”. 3- Identify the 5- Stages of Problem Solving. 4-Writing “ Algorithm” 5-Draw “ Flow Chart”

1- Understand what is “ Programming”? Eat a meal Cook that meal Buy A Robot Build A Robot Use a Game / Software Create yours with your OWN Criteria Programmer User Programming Languages : C , C++, Basic , Visual C , Visual Basic

2- Define “Problem” & “ Problem Solving”. Objectives Outputs Target/Aim/Goal - Sequence of Steps -Activities Specific Inputs Through Using Attain / Reach Problem Solving Problem

Define : 1- Problem. 2- Problem Solving . Class Activity: Using the Cards _ Group discussion Define : 1- Problem. 2- Problem Solving . Ex: 1- “ Blue Hole” / “Black or White Desert”/ “Cosmic Village” 2- Bake a Cake.

3- “ Problem Solving” Stages (5 Stages) : 1. Define the Problem: Outputs. Inputs. Executing Arithmetic or Logical Operations Example (1): 2 + 3 Example (2): A kid have 100 pounds, bought a dark choc. for 48 pounds & bottle of water for 4 pounds, So ??

3- “ Problem Solving” Stages (5 Stages) Cont. 2. Step by step instructions: Write an Algorithm الخوارزمي 2. Draw a Flow Chart Start Example (1): 2 + 3 Input 2 , 3 Start Inputs : 2, 3 Sum of 2 + 3 Output the Sum. End Sum = 2 + 3 Arrows are Must Output Sum End

Benefits of using Flowcharts: 1- Promotes / facilitate understanding the problem and shows the tasks when writing program codes. 2- Explains the program to others 3- Convenient tool for documenting the program.

The Algorithm is represented by drawing flowcharts. A Group of logically arranged procedures to be executed to attain an output using specific inputs. The Flow Chart is: It’ a diagram uses standard Graphical symbols or shapes to illustrate a sequence of steps required to solve the problem. The Algorithm is represented by drawing flowcharts.

3- “ Problem Solving” Stages (5 Stages) cont. 3. Design the Program: Writing the code Using a programming Language

During writing program code we can make mistake. 3- “ Problem Solving” Stages (5 Stages) cont. 4. Program Testing ( Debug): During writing program code we can make mistake. So, We have to check and enter the data and compare to check the errors and debug / Correct them. Start Inputs : 2, 3 Sum of 2 - 3 Output the Sum. End Example (1): 2 + 3

3- “ Problem Solving” Stages (5 Stages) cont. 5. Program Documentation: Is documenting : Given input – output – plan – for solving the problem – drawn flow chart – programming language – last date modification – people who contribute to the program development Process. WHY ??? To go back for feedback or correction

1 5 2 4 3 Problem Solving Stages Problem Definition Program Documenting -Writing all steps Taken to solve the problem - People Contributed Problem Solving Stages Input-Output-Solution 2 Step by step Instructions 4 Program Testing 3 -Writing Algorithm -Drawing a Flow Chart Program Design check and debug -Writing a code using a Programming Language

Flow Chart: Diagram that uses standard graphical symbols to illustrate: the sequence of steps required for solving a problem or specific question ( the algorithm)

The most commonly used Symbols: Significance (Terminal): Start & End ( Input / Output ) (Process): Arithmetic / Logical (Decision): Yes / No (Flow Lines): Directions

Example(1-1): Second : Algorithm First : Define the Problem Draw a flow chart that will calculate the sum of two numbers entered by the user and display the result: First : Define the Problem Outputs: The sum of Two Numbers Inputs: The 1st number is “A”, The 2nd number is “B” Solution: C = A+B , where C is the result Third : Flow Chart Second : Algorithm 1- Start 2- Enter The Number A and the Number B 3- Perform the SUM using : C=A+B , while C is the output 4- Print C 5- End Start Enter A and B C = A+ B Output C End

Note: Note: Key words Significance Read Input Get Enter Print Output

Example(1-2): First : Define the Problem Third : Flow Chart Draw a flow chart for a program that will compute the Average and the Product of three numbers: First : Define the Problem Outputs: The “Average” & the “Product” of three numbers Inputs: The 1st number is “X”, The 2nd number is “Y”, and the 3rd number is “Z” Solution: Average = (X*Y*Z)/3 and Product= X*Y*Z Third : Flow Chart Second : Algorithm 1- Start 2- Read the values X, Y, Z 3- Average = ( X+Y+Z)/3 and Product = X*Y*Z 4- Print Average and Product 5- End Start Read X, Y, Z Average= (X+Y+Z)/3 Product= X*Y*Z Print Average, Product End

Note In Any Equation: The Left side contains only one variable & it will be the output or the solution of the equation The Right side may contain values or arithmetic expressions that have one or more variables ( Inputs)

Example(1-3): First : Define the Problem Third : Flow Chart Draw a flow chart for solving a first degree equation Y= 3X+2 First : Define the Problem Output: The Value of “Y” Input: X Solution: Compute the value of “Y” from the Equation “ Y= 3X +2 “ Third : Flow Chart Second : Algorithm 1- Start 2- Read the value X 3- Calculate Y= (3*X+2) 4- Print value of Y 5- End Start Input X Y = 3*X+2 Print Y End

Area = L*W and Perimeter = 2*( L+W) Class Activity: 5 Minutes Activity (1-1) Write the Algorithm and Draw the flow chart to compute the area and perimeter of a rectangle, whose length and width are known. Area = L*W and Perimeter = 2*( L+W)

Third : Flow Chart Second : Algorithm First : Define the Problem Output: …………………………………………… Input : …………………………………………… Solution: …………………………………………… Third : Flow Chart Second : Algorithm

Third : Flow Chart Second : Algorithm First : Define the Problem Output: Perimeter , Area of a rectangle Input : L, Where “L” is length & W, where “W” is width Solution: Perimeter = 2*(L+W) , Area = L*W Third : Flow Chart Second : Algorithm 1- Start 2- Read the values: L & W 3- Calculate Perimeter = 2*(L+W) & Area = L*W 4- Print the values of Perimeter & Area 5- End Start Input L , W Perimeter = 2*(L+W) Area = L*W Print Perimeter & Area End

Class Activity: 5 Minutes Activity (1-2) Write the Algorithm and draw the Flow Chart to calculate the area of a cicle whose radius "R" is known Circle Area = 3.14 * R *R

Third : Flow Chart Second : Algorithm First : Define the Problem Output: …………………………………………… Input : …………………………………………… Solution: …………………………………………… Third : Flow Chart Second : Algorithm

Third : Flow Chart Second : Algorithm First : Define the Problem Output: Area of a Circle Input : R, Where “R” is the radius of the circle Solution: Area = 3.14 *R*R Third : Flow Chart Second : Algorithm 1- Start 2- Read the value: R 3- Calculate Area = 3.14 *R *R 4- Print the value Area 5- End Start Input R Area = 3.14 *R*R Print Area End

Homework: Activity (1-3) Write the Algorithm and draw the Flow Chart to calculate the number of years, bearing in mind that the number of months is Known