Ways to solve problems Top down approach – Break problem up into smaller problems Bottom up approach – Solve smaller problem and then add features – Examples:

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Chapter 1 - An Introduction to Computers and Problem Solving
Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Program Flow Charting How to tackle the beginning stage a program design.
Computer Science 1620 Programming & Problem Solving.
CS 201 Functions Debzani Deb.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Simplifying Fractions. October 1, 2012 Standard: 6.NS.1. Interpret & compute quotients of fractions, & solve word problems involving division of fractions.
Python quick start guide
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
6 Steps of the Programming Process
Programming Languages: Telling the Computers What to Do Chapter 16.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Program Development Life Cycle (PDLC)
What is an Array? An array is a collection of variables. Arrays have three important properties: –group of related items(for example, temperature for.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
CPS120: Introduction to Computer Science Lecture 14 Functions.
Flowcharts. Problem Solving Computer programs are written to solve problems or perform tasks Programmers translate the solutions or tasks into a language.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
1 Program Planning and Design Important stages before actual program is written.
1 CS161 Introduction to Computer Science Topic #9.
Chapter One An Introduction to Programming and Visual Basic.
The Art of Programming. The process of breaking problems down into smaller, manageable parts By breaking the problem down, each part becomes more specific.
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.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
CISC105 – General Computer Science Class 2 – 6/7/2006.
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.
Copyright 1999 by Larry Fuhrer. Pascal Programming Branching, Loops, Predefined Functions.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
CMSC 2021 Software Development. CMSC 2022 Software Development Life Cycle Five phases: –Analysis –Design –Implementation –Testing –Maintenance.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Introduction to Computer Programming using Fortran 77.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Learning Javascript From Mr Saem
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Unit 1 Review By: Mr. Jacobs.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
 Problem Analysis  Coding  Debugging  Testing.
Arithmetic Instructions. Integer and Float Conversions.
Bill Tucker Austin Community College COSC 1315
ICS 3UI - Introduction to Computer Science
Compilation and Debugging
Compilation and Debugging
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Topic: Functions – Part 2
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.
Problem Solving Techniques
Chapter 2- Visual Basic Schneider
8.5: Adding and Subtracting Rational Expressions
A programming language
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
ICT Programming Lesson 1:
An Overview of C.
CHAPTER 6 Testing and Debugging.
Presentation transcript:

Ways to solve problems Top down approach – Break problem up into smaller problems Bottom up approach – Solve smaller problem and then add features – Examples: payroll problem (book), stock market portfolio (started last lecture) Combined approach

Stock Portfolio Task Write a program to analyze a stock portfolio consisting of some number of different stocks we own. For each stock we have information on how many shares we own, how much we paid for each share, and how much each share is worth now. Stock prices are expressed as a whole dollar amount and a fraction (e.g. 1/2, 1/4, 1/8, etc.). We would like to compute how our portfolio is worth and how much profit we have made if we liquidated it today.

Bottom Up Approach Start with a simplified version of the task, get it working, and then add features until we have solved the entire problem. So, let's assume we have a stock portfolio consisting of just one stock (say in XYZ Corp.). Furthermore, we will only compute how much this little portfolio is worth at first. So we begin with our five step design process.five step

The Five Steps Understanding the problem Do a small example by hand Write an algorithm for solving the problem Translate the algorithm into a programming language (like C) Test the program

C Program Contents Comments: in beginning and throughout program Header statements: include C libraries Functions (main, library, your functions): – Header: function name and arguments main() – Body Declarations Statements: assignments, expressions, calling other functions, generating output

Testing the program Removing errors from a program is called debugging. Debugging usually takes time!!! Types of errors – Syntax: Grammar errors, usually easy to fix – Link: Statements undefined, usually easy to fix – Run time: Computation Errors: (e.g. dividing by zero) Logic Errors: more difficult to remove