CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING

Slides:



Advertisements
Similar presentations
ALGORITHMS AND FLOWCHARTS
Advertisements

PROBLEM SOLVING TECHNIQUES
PSEUDOCODE & FLOW CHART
Algorithms and Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
INTRODUCTION TO PROGRAMMING
Chapter 2- Visual Basic Schneider
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
Review Algorithm Analysis Problem Solving Space Complexity
PRE-PROGRAMMING PHASE
Software Engineering 1 (Chap. 1) Object-Centered Design.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
CSC141 Introduction to Computer Programming
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.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Software Life Cycle What Requirements Gathering, Problem definition
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.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
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.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
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 One Problem Solving
Unit 3: ALGORITHMS AND FLOWCHARTS
Chapter One Problem Solving
Problem , Problem Solving, Algorithm & Flow Charts –Part 1
Computer Programming.
Chapter 2: Input, Processing, and Output
Chapter 2- Visual Basic Schneider
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.
ALGORITHM Basic CONCEPTS of Basic Concepts of Algorithm
2.0 Problem Solving PROGRAM DESIGN
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.
Introduction to Computer Programming
Algorithm and Ambiguity
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
Problem Solving Techniques
PROBLEM SOLVING CSC 111.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
1) C program development 2) Selection structure
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Chapter 1 Introduction(1.1)
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Algorithm and Ambiguity
Understanding Problems and how to Solve them by using Computers
Programming Fundamentals (750113) Ch1. Problem Solving
Software Development Process
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
ICT Gaming Lesson 2.
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 2: Input, Processing, and Output
Basic Concepts of Algorithm
Programming Logic and Design Eighth Edition
Presentation transcript:

CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING PROBLEM SOLVING PHASES

CONTENT Program development life cycle. Use IPO chart, Algorithm, Pseudocode, and flowchart.

Program Development Life Cycle (PLDC) This methodology consist of steps programmers use to build computer programs.

PDLC Analysis Design Implementation Testing and debugging Maintenance

STEP 1: ANALYSIS The purpose: to describe in detail a solution to a problem and information needed in solving the problem. How?? Study and understand the problem Identify: Specify the input Specify the output Specify the process ( formulas)

To bake a cake…. INPUT

To bake a cake….(cont.) PROCESS

To bake a cake….(cont.) OUTPUT

PROBLEM: To calculate and display age

STEP 1: ANALYSIS IPO Chart Input Process Output yearBorn Age = currentYear - yearBorn Age

STEP 2: DESIGN Definition: it is a framework or flow that shows the step in problem solving. Method to use: Algorithm Pseudocode flowchart

ALGORITHM A sequence of instruction to solve a problem, written in human language. Get/input the year born Calculate the age using the formula age = current year – year born Print/ display the age

PSEUDOCODE Steps in problem solving that is written in half programming code and half in human language. For example, some part uses C++ language code and some part uses English language Begin Read the year born from the user. Age = currentYear - yearBorn Print the user age. End

FLOWCHART A representation of graphical symbols to show process or steps in problem solving.

Symbols Descriptions Terminal symbol - indicates the beginning and end points of an algorithm. Input-output symbol - shows an input or an output operation. Process symbol - shows an instruction other than input, output or selection. Decision symbol - shows a selection process for two-way selection. On-page connector - provides continuation of logical path at another point in the same page. Flow lines - indicate the logical sequence of execution steps in the algorithm

Flowchart Start Input year born Age = current year – year born Print age End

STEP 3: IMPLEMENTATION The process of writing the code that translate the design into a computer program using a programming language. Different languages have different syntax. A language syntax’s is the set of grammar and rules that specifies how to write instructions for an algorithm.

Coding # include <iostream.h> void main() { int yearBorn; int age; int curYear ; cout<< “please enter the current year:”; cin>>curYear; cout<<“please enter year born: ”; cin>>yearBorn; age = curYear – yearBorn; cout<<“Your age is:”<<age; }

STEP 4: TESTING The process of running the program and checking for errors. This is to ensure that the programs works like it supposed to. Types of errors: Syntax error Caused by incorrectness in syntax, spelling, undeclared or undefined variables. Run – time error Error that occurs while program is executed with statement that requires the compiler to do something illegal, e.g. division with zero. Logic error Errors in logic or meaning. Output may be produced but not the right one.

STEP 4: TESTING Debugging Process of locating and correcting errors in a program.

EDIT – COMPILE – DEBUG - LOOP Begin Edit program Compile program Compiler errors? Test program Run-time errors? End True False True False

STEP 5: MAINTENANCE Any activity that is designed to keep the program in working condition – modification, repairs, enhancement, replacements … Documenting the program – useful incase of modification or maintenance. User manual

Exercise: Problem 1 Write a program that will get two numbers from user. Find the summation and the display the result.

Exercise: Problem 2 Write a program that will get two numbers from user. Find the average and the display the result.

Exercise: Problem 3 To calculate the total of students in a school if the total of boy student are 501 and the total of the girl student is 700.

Extra exercises

Exercise 1 Assume that you have to write a program to calculate area of a circle using the formula given: area = radius * radius * 3.142 a) define the input, process and output b) draw the flowchart c) write the pseudocode

Exercise 2 Write a pseudocode and a flowchart for converting temperature from Fahrenheit to Celsius. User need to input the Fahrenheit. The formula is as follow: celsius = 5.0/9.0 * (Fahrenheit – 32.0)

Exercise 3 Assume that you have to write a program to calculate the area of rectangle. Determines the input, output, process. Draw the flowchart Write the pseudocode