Professional Documents
Culture Documents
01-Tcp2103-Problem Solving
01-Tcp2103-Problem Solving
01-Tcp2103-Problem Solving
Chapter 1 :
Problem Solving
INTRODUCTION TO PROGRAMMING
Objectives
Problem
Problem example
• Problem 1
1. Call guests and keep a count of the ones who can
come
2. Make a shopping list and buy food.
3. Clean apartment
4. Move furniture
5. Welcome guests
6. Have the party
7. Say goodbye to leaving guests.
8. Clean up apartment and move furniture back.
INTRODUCTION TO PROGRAMMING
• Problem 2
1.0 Find nearest vending machine
2.0 Insert coins
• If coins inserted >= price
• Choose beverage
• Go to 3.0
• Else
• Go to 2.0
3.0 Have change
4.0 Give beverage
INTRODUCTION TO PROGRAMMING
Formulate mathematical
model
Develop an algorithm
• Input
• What kind of input is there?
• Process
• What tasks do the objects perform on this data?
• Output
• What should my output look like?
INTRODUCTION TO PROGRAMMING
• Problem example
3. Develop an Algorithm
3. Develop an algorithm
• Definition :
• A set of detailed, unambiguous and
ordered instructions develop to describe
the processes necessary to produce the
desired output from a given input.
• Is written in simple English and is not a
formal document
INTRODUCTION TO PROGRAMMING
3. Develop an algorithm
3. Develop an algorithm
3. Develop an algorithm
exercise
Review Questions
Exercise
Guide
Guide
TF = TC x 9/5 + 32
INTRODUCTION TO PROGRAMMING
The End