BME303_lecture11

BME303_lecture11 - BME303 Intro to Computing Chapter 6...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
BME303 Intro. to Computing 1 Chapter 6: Programming Methodologies for creating computer programs that perform a desired function. 1. Problem Solving How do we figure out what to tell the computer to do? Convert problem statement into algorithm, using stepwise refinement . Convert algorithm into LC-3 machine instructions. 2. Debugging How do we figure out why it didn’t work? Examining registers and memory, setting breakpoints, etc. Time spent on the first can reduce time spent on the second!
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BME303 Intro. to Computing 2 Stepwise Refinement •Also known as systematic decomposition . •Start with problem statement: “We wish to count the number of occurrences of a character in a file. The character in question is to be input from the keyboard; the result is to be displayed on the monitor.” •Decompose task into a few simpler subtasks . •Decompose each subtask into smaller subtasks , and these into even smaller subtasks , etc. ... until you get to the machine instruction level.
Background image of page 2
BME303 Intro. to Computing 3 Problem Statement •Because problem statements are written in English, they are sometimes ambiguous and/or incomplete. – Where is “file” located? How big is it, or how do I know when I’ve reached the end? – How should final count be printed? A decimal number? – If the character is a letter, should I count both upper-case and lower-case occurrences? •How do you resolve these issues? – Ask the person who wants the problem solved, or – Make a decision and document it.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BME303 Intro. to Computing 4 Three Basic Constructs There are three basic ways to decompose a task: Task Subtask 1 Subtask 2 Subtask 1 Subtask 2 Test condition Subtask Test condition Sequential Conditional Iterative True True False False
Background image of page 4
BME303 Intro. to Computing 5 Which construct? • As long as there is money in my bank account, keep spending it… Iterative Money in account spend True False
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BME303 Intro. to Computing 6 Which construct? • A+B+C • A·B·C A+B (A+B)+C A*B (A*B)*C
Background image of page 6
7 Which construct? • Use credit card for purchases above $100,
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course BME 303 taught by Professor Ren during the Fall '08 term at University of Texas.

Page1 / 27

BME303_lecture11 - BME303 Intro to Computing Chapter 6...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online