Week 002 Problem Solving Through Flowcharts 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Week 002

Problem Solving through


Flowcharts 1
Week 002: Problem Solving through Flowcharts 1

Flowcharts and Pseudocodes


“In this presentation, you will be presented with a
series of scenarios applicable to your daily lives. Those
scenarios will be converted to their flowchart and
pseudocode counterpart. I advice you to try and come
up with your version of the corresponding flowchart
and pseudocodes before proceeding to the succeeding
slides.”

James Michael Adoremos


Course Developer
Week 002: Problem Solving through Flowcharts 1

P01: Food Intake | Scenario


One of our daily routines is eating. However, you can
only eat if there is food already prepared for you. If
there are none, you should cook food on your own
before you take a big gulp.

Now, how will that look like if turned to flowchart and


pseudocode?
Week 002: Problem Solving through Flowcharts 1

P01: Food Intake | Flowchart


Week 002: Problem Solving through Flowcharts 1

P01: Food Intake | Pseudocode


FoodIntake()
1. DECLARE isFoodPrepared
2. SET isFoodPrepared TO CheckIfFoodIsPrepared()
3. IF NOT isFoodPrepared THEN
4. CALL PrepareFood()
5. END
6. CALL EatFood()
Week 002: Problem Solving through Flowcharts 1

P02: Weekend Routine | Scenario


Is it weekends? Is it weekends? That is one of the
questions we ask ourselves daily. We wake up in the
morning, check if it is weekends already. If it is, we sleep
again. If it is not, we take a bath.

Now, how will that look like if turned to flowchart and


pseudocode?
Week 002: Problem Solving through Flowcharts 1

P02: Weekend Routine | Flowchart


Week 002: Problem Solving through Flowcharts 1

P02: Weekend Routine | Pseudocode


WeekendRoutine()
1. DECLARE isWeekends
2. SET isWeekends TO CheckIfWeekends()
3. IF isWeekends THEN
4. CALL Sleep()
5. ELSE
6. CALL TakeBath()
7. END
Week 002: Problem Solving through Flowcharts 1

P03: Daily Chores | Scenario


We are given chores depending on the day. On
weekends, we are tasked to do the laundry. On
weekdays except Friday, we are tasked to do a general
cleaning. On Fridays, we are tasked to a grocery spree.

Now, how will that look like if turned to flowchart and


pseudocode?
Week 002: Problem Solving through Flowcharts 1

P03: Daily Chores | Flowchart


Week 002: Problem Solving through Flowcharts 1

P03: Daily Chores | Pseudocode


DailyChores()
1. DECLARE day
2. SET day TO GetDay()
3. IF day = “Saturday” OR day = “Sunday” THEN
4. CALL DoLaundry()
5. ELSE IF day = “Friday” THEN
6. CALL DoGrocery()
7. ELSE
8. CALL DoGeneralCleaning()
9. END
Week 002: Problem Solving through Flowcharts 1

P04: Study, Games and Everything Nice | Scenario


As students, we were forced to a study habit. On
weekdays, we are to study our lessons. On weekends,
we are free to play with the computer. After studying
and playing computer games, we still have time to
watch television.

Now, how will that look like if turned to flowchart and


pseudocode?
Week 002: Problem Solving through Flowcharts 1

P04: Study, Games and Everything Nice | Flowchart


Week 002: Problem Solving through Flowcharts 1

P04: Study, Games and Everything Nice | Pseudocode


StudyGamesAndEverythingNice()
1. DECLARE isWeekend
2. SET isWeekend TO GetIsWeekend()
3. IF isWeekend THEN
4. CALL DoStudyLesson()
5. ELSE
6. CALL DoPlayComputer()
7. END
8. CALL DoWatchTelevision()
Week 002: Problem Solving through Flowcharts 1

P05: Garden, Oh My Garden | Scenario


Imagine a huge house with a beautiful garden. With
that, you need to ensure the garden is kept well-
maintained. If it is messy, you should do something
about it. If you are the owner, call the caretaker to do
the gardening; if not, do the gardening yourself.

Now, how will that look like if turned to flowchart and


pseudocode?
Week 002: Problem Solving through Flowcharts 1

P05: Garden, Oh My Garden | Flowchart


Week 002: Problem Solving through Flowcharts 1

P05: Garden, Oh My Garden | Pseudocode


GardenOhMyGarden()
1. DECLARE isGardenMessy, amIOwner
2. SET isGardenMessy TO GetIsGardenMessy()
3. SET amIOwner TO GetAmIOwner()
4. IF isGardenMessy THEN
5. IF amIOwner THEN
6. CALL CallGardener()
7. ELSE
8. CALL DoGardening()
9. END
10. END

You might also like