Beruflich Dokumente
Kultur Dokumente
11506816
MMINTER2
Homework # 2
1. A researcher computes for the grade of his students using the formula: grade = exam * 40%
+ quiz * 40% + attendance * 20%. If the student incurred no absence (attendance is 100), a
bonus of 10 is added to the grade, otherwise only 2 points is added. Design an algorithm using
a selection structure for program that will obtain the students data and display the
corresponding grade.
INPUT:
exam grade,quizgrade, attendance
PROCESS:
exam grade * 0.4, quiz grade * 0.4,
attendance * 0.4
attendance =/= 100 + 10, >100 =
+ 2
final grade = exam grade + quiz
grade + attendance
OUTPUT: final grade
Start
Set finGrd = 0; exmGrd = 0;
qzGrd = 0; attGrd = 0
Input exmGrd
Read exmGrd
Input qzGrd
Read qzGrd
Input attGrd
IF (attGrd == 100)
THEN finGrd = ((exmGrd *
0.4) + (qzGrd * 0.4) +
attGrd * 0.2)) + 10
ELSE
THEN finGrd = ((exmGrd *
0.4) + (qzGrd * 0.4) +
attGrd * 0.2)) + 2
Display finGrd
END IF
Stop
SIMULATION:
Enter exam grade: 80
For example, a salesperson who sells P10,000 worth of chemicals in a week receives P3500
plus 10 percent of P10,000, or a total of P4500.
Design a algorithm using a selection structure for program that will obtain salespersons gross
sales. The program then will calculate and display the salespersons total earnings.
INPUT:
grossSale, salary, quota
PROCESS:
grossSale >= quota, salary +
(0.1*grossSale),
Start
Input grossSale
Read grossSale
SIMULATION:
Enter sales: 5000
Total earnings: 3500.00