Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop.

Similar presentations


Presentation on theme: "Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop."— Presentation transcript:

1 Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop multiple plans and compare. Usually refine plan before implementation 3) Execute the plan 4) Check your results 5) Modify as necessary Often means starting back at number one with a new understanding of the problem Writing a program to address a need involves problem solving

2 Programming Intro Try This: Use the following commands and objects to explain how to make a peanut butter and jelly sandwich CommandsqualifiersObjects____ FetchFromrefrigerator Openincupboard SpreadonPeanut Butter ThrowaboveBread SlicebelowJelly BeatwithBreadbox PlaceusingKnife PickbetweenFingers DumptopNose RubagainstTrash

3 Programming Intro Try This: Two variables x and y. Commands: Store ___ in x Store ___ in y Add 1 to x Add 1 to y Add x to y Subtract 1 from x Subtract 1 from y Subtract x from y Do _____ times: a) 4 + 5 b) 5 – 2 c)3 x 2 d)3 x 2 +1 e)3 x 2 + 3 Think about division, what other commands would you need? Example: Store 4 in x Do 5 times add 1 to x OR Store 4 in x store 5 in y add x to y

4 Programming Intro Syntax and semantics: Syntax: The set of rules for creating statements, Semantics: The meaning of a statement. In a programming language the semantics are well- defined. The language is formed so that the compiler does not have to “decide” between possible meanings. Fruit flies like a bananna – Groucho Marx

5 Programming Intro Errors: Compile time: syntax errors, type errors. Runtime error: occurs when program is run Logical error: Program runs, but not how you want it to.

6 Programming Intro Object oriented programming. Focuses on Objects. Try This: You want to model an apple. What attributes does a apple have? What does an apple do?

7 Programming Intro Object: Apple Qualities: color, sweetness, pithiness, size Methods: fall, rot, roll

8 Programming Intro Try This: You think of an object. List attributes you would program into your object. List things you want to program your object to do:


Download ppt "Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop."

Similar presentations


Ads by Google