Awddawd

You might also like

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

Seth Vicef C.

Somoza
Branching 21-30

Flowcharts
Pseudocode

P21 1 Start
2 Display “Enter first number: “, <fnum>
3 Display “Enter second number: “, <snum>
4 If fnum>snum
5 Display <fnum> “ is greater than “ <snum>
6 Else
7 Display <snum> “ is greater than “ <fnum>
8 Stop

P22 1 Start
2 Initialize <pinCode>=340023
3 Display “Enter 6-digit pin code: “, <pin>
4 If pin==pinCode
5 Display “You entered the correct pin code!”
6 Else
7 Display “Your pin code is incorrect.”
8 Stop

P23 1 Start
2 Display “Enter an integer number: “, <num>
3 If num>=0
4 Display <num> “ is a positive integer.”
5 Else
6 Display <num> “ is a negative integer.”
7 Stop

P24 1 Start
2 Display “Enter a number from 0 to 10: “, <num>
3 If num==1
4 Display “One.”
5 Else If num==2
6 Display “Two.”
7 Else If num==3
8 Display “Three.”
9 Else If num==4
10 Display “Four.”
11 Else If num==5
12 Display “Five.”
13 Else If num==6
14 Display “Six.”
15 Else If num==7
16 Display “Seven.”
17 Else If num==8
18 Display “Eight.”
19 Else If num==9
20 Display “Nine.’
21 Else If num==10
22 Display “Ten.”
23 Else
24 Display “You did not enter a number from 1-10. Repeat the code.”
25 Stop

P25 1 Start
2 Initialize <grosspay>=0
3 Display “Enter number of hours worked. “, <hours>
4 If hours>=41
5 Calculate <grosspay>=(40*8)+(1.5*8*(<hours>-40))
6 Display “Grosspay is “ <grosspay>
7 Else
8 Calculate <grosspay>=hours*8
9 Display “Grosspay is “ <grosspay>
10 Stop

P26 1 Start
2 Display “Select beacon’s color (B or R): “, <color>
3 Display “Select beacon’s mode (S or F): “, <mode>
4 If color==b and mode==s
7 Display “You selected blue and steady. The weather is CLEAR VIEW”
8 Else if color==b and mode==f
9 Display “You selected blue and flashing. The weather is CLOUDS DUE”
10 Else if color==r and mode==s
11 Display “You selected red and steady. The weather is RAIN AHEAD”
12 Else if color==r and mode==f
13 Display “You selected red and flashing. The weather is SNOW INSTEAD”
14 Else
15 Display “The answer you entered is not included in the choices mentioned. Please try
again.”
16 Stop

P27 1 Start
2 Initialize
3 <bill>=0
4 <deposit>=300
5 Display “Enter equipment (1, 2, 3): ”, <equip>
4 Display “Enter duration (H or F): ”, <dur>
5 If equip==1 and dur==H
6 Calculate <bill>=160+<deposit>
7 Display “Your bill is “<bill>
8 Else if equip==1 and dur==F
9 Calculate <bill>=240+<deposit>
10 Display “Your bill is “<bill>
11 Else if equip==2 and dur==H
12 Calculate <bill>=120+<deposit>
13 Display “Your bill is “<bill>
14 Else if equip==2 and dur==F
15 Calculate <bill>=180+<deposit>
16 Display “Your bill is “<bill>
17 Else if equip==3 and dur==H
18 Calculate <bill>=200+<deposit>
19 Display “Your bill is “<bill>
20 Else if equip==3 and dur==F
21 Calculate <bill>=300+<deposit>
22 Display “Your bill is “<bill>
23 Else
24 Display “You have entered the incorrect combination. Please try again.”
25 Stop

P28 1 Start
2 Initialize
<bmi>=0
<index>=0
<under>="underweight"
<norm>="normal"
<overweight>="overweight"
<obese>="obesity"
3 Display “Customer name: “, <name>
4 Display “Enter your weight in pounds: “, <weight>
5 Display “Enter your height in inches: “, <height>
6 Calculate <bmi>=703*<weight>/(<height>*<height>)
7 If bmi<=18.5
8 Display “Your BMI is “ <bmi> “. You are “ <under>
9 Else If bmi>=18.5 and <=24.9
10 Display “Your BMI is “ <bmi> “. You are “ <norm>
11 Else If bmi>=25 and <=29.9
12 Display “Your BMI is “ <bmi> “. You are “ <overweight>
13 Else If bmi==30
14 Display “Your BMI is “ <bmi> “. You are “ <obese>
15 Stop

P29 1 Start
2 Initialize <score>=0
3 Display “The squeaky wheel gets the grease. (T or F)”, <value>
4 If ans==T
5 <score>++
6 Display “Cry and you cry alone. (T or F)”, <value>
7 If ans==T
8 <score>++
9 Display “Opposites attract. (T or F”, <value>
10 If ans==F
11 <score>++
12 Display “Spare the rod and spoil the child. (T or F)”, <value>
13 If ans==F
14 <score>++
15 Display “Actions speak louder than words. (T or F)”, <value>
16 If ans==T
17 <score>++
18 Display “Familiarity breeds contempt. (T or F)”, <value>
19 If ans==F
20 <score>++
21 Display “Mary in haste, repent at leisure. (T or F)”
22 If ans==T
23 <score>++
24 If score==7
25 Display “You got perfect! Your score is “ <score>
26 Else if score >5 or ==5 but <7
27 Display “Excellent! Your score is “ <score>
28 Else if score >=0 or <=4
29 Display “You might consider taking psychology 101. Your score is “ <score>
30 Stop

P30 1 Start
2 Display “Enter the number of the month.”, <month>
3 If month==1
4 Display “January has 31 days.”
5 Else If month==2
6 Display “Leap year or not? Y/N”, <leap>
7 If leap==y
8 Display “February in a leap year has 29 days.”
9 Else
10 Display “February in a common year has 28 days.”
11 Else If month==3
12 Display “March has 31 days”
13 Else if month==4
14 Display “April has 30 days”
15 Else if month==5
16 Display “May has 31 days”
17 Else if month==6
18 Display “June has 31 days”
19 Else if month==7
20 Display “July has 31 days”
21 Else if month==8
22 Display “August has 31 days”
23 Else if month==9
24 Display “September has 30 days”
25 Else if month==10
26 Display “October has 31 days”
27 Else if month==11
28 Display “November has 30 days”
29 Else if month==12
30 Display “December has 31 days”
31 Else
32 Display “You have entered and incorrect number. Please try again.”
33 Stop

You might also like