230 likes | 432 Views
Introduction to Problem Solving Lecture. CSC 135 Brenda Wilson. Problem Solving. Algorithm - set of instructions for accomplishing a task unambiguous effective finite (except for continuous processing) Computer Program - algorithm suitable for execution on a computer.
E N D
Introduction to Problem SolvingLecture CSC 135 Brenda Wilson
Problem Solving • Algorithm - set of instructions for accomplishing a task • unambiguous • effective • finite (except for continuous processing) • Computer Program - algorithm suitable for execution on a computer
ANSI says you are a device that can perform substantial ... . What am I? Definition A machine that can accept data, process the data, at high speeds , and give the results in an acceptable form with option of saving data & results.
Does not compute!! Figure the deductions Then tell me... What we have here is a failure to communicate...
What does a computer understand??? 110001001110 Machine Language
Compiler/ Interpreter Assembler Needs Translation!! • High-Level Languages • Pascal, C++,Ada • VisualBasic, Cobol, Fortran,etc. • Assembly Language • Machine Language
Interpreter Vs. Compiler • Interpreter • translates & executes one line at a time • Compiler • translates entire program & then executes
Executing a Compiled Program High Level Language Compile Object Module Build Load Module Execute
Terms used to describe High Level Languages • Structured – vs. spaghetti code • Procedural – programmer driven • Event-Driven • Object-Oriented – class,attributes, etc. R.A.D.
Beginning: Do You Understand? • How problem is presented: • Required Results • Given Info • Process • How Program is written: • Given Info • Perform Processing • Req.Results • Input-Process-Output
Tools Used for Algorithm Development • I/O Chart -- to analyze input & output • I O Gross Pay Deductions Net Pay Names Hrly Rates Hours Wrkd
Tools Used for Algorithm Development Structure Chart - to show major tasks & subtasks
Module In Out Tools Used for Algorithm Development • Top Down Design: Use pseudocode or flowchart (to show how each module works) • Module Interface Table : to show how each module shares data with other modules in the program
Sender (Programmer) good overall picture good generalizing terrible at details slow!!! Receiver (Computer) good at details fast!!! terrible at overall picture terrible at new situations & inference Programming Language : set of notations & rules for combining notations to communicate algorithms
Programming Languages • Syntax - set of formal rules determining valid constructions • Semantics - rules determining precise meaning of valid constructions in the language • “Bug”
Proper Grammar Whoops!! Should be a quotation not apostrophe! (Ada) Put (“Enter your name’); lblArea.caption = txtLngth.text*txtWidth.txt Whoops!! Misspelled ‘text’! (VBasic) SYNTAX...
What is meant?? The chicken is ready to eat. SEMANTICS...
Computer Operations • Perform arithmetic • Compare 2 pieces of information & take alternative actions • Receive & give out information • Repeat any group of these operations • Save any information for later use
5 Operations of the Computer…examples in different languages
Challenge: An English-speaking person from Guyana, S.A. has just come to visit at your house for a few days. This person has never used a cordless phone (maybe never even used a telephone at all!!). Write down instructions for this visitor to follow to make a phone call when he/she is alone in the house. Try to not assume any prior knowledge and try to think of every thing that could happen when the person tries to make a call. (example…is there a dial tone, if not—what to do!)