0% found this document useful (0 votes)
185 views9 pages

Answer LaboratoryExercise001

I was assigned various childcare tasks throughout the day including preparing milk by 9:00 AM, cooking lunch by 11:00 AM, bathing my brother by 3:00 PM, and having a game with my team by 5:00 PM, with the requirement that I wait during times not specified for a task. A flowchart and pseudocode were provided to illustrate the logic for completing the time-specific tasks and waiting in between. I was also given a physics problem where I must determine which of five cubes weighs more using only two weighings by separating the cubes into pairs.

Uploaded by

Jong Suk Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
185 views9 pages

Answer LaboratoryExercise001

I was assigned various childcare tasks throughout the day including preparing milk by 9:00 AM, cooking lunch by 11:00 AM, bathing my brother by 3:00 PM, and having a game with my team by 5:00 PM, with the requirement that I wait during times not specified for a task. A flowchart and pseudocode were provided to illustrate the logic for completing the time-specific tasks and waiting in between. I was also given a physics problem where I must determine which of five cubes weighs more using only two weighings by separating the cubes into pairs.

Uploaded by

Jong Suk Lee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Laboratory Exercise 001

Question:

1. You are left in charge of taking care of your baby brother. Your mother asked you to prepare the milk by 9:00 AM. Your father asked you to cook lunch by
11:00 AM. You need bathe your brother by 3:00 PM. Lastly, at 5:00 PM, you have your scheduled game with your team. Remember that each activity is time-
specific. For the time outside the specified hours, you are to do nothing but wait.

a
Understanding of the Problem #1:

vi
I was left in charge to take care of my baby brother and was assigned tasks on several times of the day. Since the tasks are time-specific, I can’t do
anything but wait until I reached the time for the next task.

d
Flowchart for Problem #1:

e
A

ar
START

sh
Check Time Check Time

as
w
Yes 3:00 No
Yes 9:00 No

m e
PM?
AM?

co rc
o. ou
Bathe my brother Wait
Prepare Milk Wait
er res

Check Time
Check Time
se dy
ur tu

Yes 11:00 No
Yes No
5:00
s

AM?
H

PM?
is

Wait
Th

Cook lunch
Game with my team Wait
This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
END
Laboratory Exercise 001

a
vi
de
ar
sh
as
w
m e
co rc
o. ou
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Laboratory Exercise 001

Pseudocode for Problem #1:

1. DECLARE time
2. SET time AS GetCurrentTime()
3. WHILE time !=9:00 AM DO
CALL DoWait()

a
LOOP

vi
4. CALL DoPrepareMilk()
5. SET time AS GetCurrentTime()

d
6. WHILE time !=11:00 AM DO

e
CALL DoWait()

ar
LOOP
7. CALL DoCookLunch()

sh
8. SET time AS GetCurrentTime()
9. WHILE time !=3:00 PM DO
CALL DoWait()

as
LOOP
10. CALL DoBatheMyBrother()

w
11. SET time AS GetCurrentTime()
12. WHILE time !=5:00 PM DO

m e
CALL DoWait()
LOOP
13. CALL DoGameWithMyTeam() co rc
o. ou
14. END
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Laboratory Exercise 001

Question:

2. You were given five cubes and you were tasked by your Physics course instructor to determine the one cube that weighs greater than the rest. Four of the
cubes have the same weight. You are only given to chances to weigh a set of cubes. After the second weigh, you need to accurately discern the one cube
that weighs more.
[Hint]

a
o To weigh the five cubes only up to two times to determine which one weighs more, you will need to weigh for the 1st round four cubes by twos

vi
and leave one cube aside.
o If the two parts of weighed cubes are equal, then the cube we need to determine is the fifth cube – the one we set aside.
o If not, then one of the four cubes we weighed is the one we need. To do this, we will disregard the pair that weighs lesser and focus on the pair

d
that weighs more. We will weigh that pair for our 2nd round, and the cube that weighs more than the other is the cube that we need.

e
ar
Understanding of the Problem # 2:

sh
I need to determine which cube is the heaviest. There are only two chances to weigh the cubes. To get the heaviest cube, I need to group the cubes by
two for my first weigh.

as
So, Cube 1 and Cube 2 will be Set A and Cube 3 and Cube 4 will be Set B, respectively. If the two sets have equal weight, then I can assume that the
heaviest cube is Cube 5.

w
If Set A is greater than Set B, I will put Set B and Cube 5 aside and weigh Cube 1 and 2 to determine which cube is heavier. The heavier cube between the
two can be assumed as the heaviest cube among the five cubes. Same thing will be applied if Set B is heavier than Set A.

m e
Flowchart for Problem #2:

co rc START
o. ou
Set A = Cube 1 + Cube 2; Set B = Cube 3 + Cube 4
er res

NO YES
se dy

A = B?
ur tus

NO YES
H

A > B?
is
Th

This study source


Cube 4 was downloaded by 100000782540836 from CourseHero.com
Cube 3 on 09-20-2021 04:17:22 GMTCube
-05:002 Cube 1 Cube 5
NO END
Laboratory Exercise 001

Cube 3 > YES NO Cube 1 > YES


Cube 4? Cube 2?

a
vi
e d
ar
sh
as
w
m e
co rc
o. ou
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Laboratory Exercise 001

Pseudocode for Problem #2:

DECLARE Weight
SET A AS GetWeightCube1+Cube2()
SET B AS GetWeightCube3+Cube4()
IF A = B THEN

a
OUTPUT Cube5

vi
ELSE IF A > B THEN
IF Cube1 > Cube2 THEN

d
OUPUT Cube1

e
ELSE

ar
OUTPUT Cube2
ELSE IF B > A THEN

sh
IF Cube3 > Cube4 THEN
OUPUT Cube3
ELSE

as
OUTPUT Cube4
END

w
m e
co rc
o. ou
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Laboratory Exercise 001

Question:

3. You are to travel to Palawan for a beach escapade. Since you are going, you need a set of materials for the trip. List down all the items you need, create a
checklist beforehand, determine whether you already have each of the items, and buy the items you do not yet have. Indicate at least 5 items.

Understanding of the Problem #3:

a
I will travel to Palawan for a beach escapade so I need to bring some beach essentials with me for the trip. I need to list the items I need and make a checklist

vi
so I can make sure if I have them on hand or I need to go to the store and buy them. I will have to indicate at least 5 items.Flowchart for Problem #3:
START B

e d
List of Items: Sunscreen,

ar
Swimsuit, Beach Bag,

sh
Sunglasses and Camera Have beach
bag?

as
Buy item Check item on checklist
Create a checklist

w
m e
Have
NO sunscreen? YES
co rc Have
sunglasses?
o. ou
Check item on checklist Buy item Check item on checklist
Buy item
er res
se dy

Have
swimsuit?
ur tu

Have
camera?
Buy item Check item on checklist
s
H

Buy item Check item on checklist


is
Th

B
This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
END
Laboratory Exercise 001

Pseudocode for Problem #3:

1. DECLARE ListofItems
2. SET ListofItems AS PutItemOnAChecklist()
3. IF NOT HaveSunscreen THEN
Call DoBuyItem(Sunscreen)

a
4. CALL DoCheckItemOnChecklist(Sunscreen)

vi
5. IF NOT HaveSwimsuit THEN
Call DoBuyItem(Swimsuit)

d
6. CALL DoCheckItemOnChecklist(Swimsuit)

e
7. IF NOT HaveBeachBag THEN

ar
Call DoBuyItem(BeachBag)
8. CALL DoCheckItemOnChecklist(BeachBag)

sh
9. IF NOT HaveSunglasses THEN
Call DoBuyItem(Sunglasses)
10. CALL DoCheckItemOnChecklist(Sunglasses)

as
11. IF NOT HaveCamera THEN
Call DoBuyItem(Camera)

w
12. CALL DoCheckItemOnChecklist(Camera)
13. END

m e
co rc
o. ou
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Laboratory Exercise 001

Question:

4. What can you conclude from this activity?


I have learned on how to create pseudocodes and be more familiar in using flowchart symbols. I am looking forward to learning more of these in the
future.

a
vi
de
ar
sh
as
w
m e
co rc
o. ou
er res
se dy
ur tus
H
is
Th

This study source was downloaded by 100000782540836 from CourseHero.com on 09-20-2021 04:17:22 GMT -05:00
Powered by TCPDF (www.tcpdf.org)

You might also like