mODULE2 ALGO PSEUDO SAMPLE

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Write the algorithm and pseudo code to compute the total fee and the ending

balance to be paid by the student for the whole semester. The program will allow
the user to give the total units to be enrolled and the estimated amount per unit.
Tuition fee can be computed by multiplying amount per unit with the total units to
be enrolled. In order to compute the total fee you need to add the value of tuition
fee to the value of miscellaneous and book fee given by the user. Ending balance
can be computed by deducting 30% discount of tuition fee on the value of total fee.
Display all the results.
Given: 30% tuition fee discount
Missing: total fee, ending balance, total units, estimated amount per unit,
miscellaneous, book fee, tuition fee.
INPUT: Ask the user for the value of total units, estimated amount per unit,
miscellaneous, book fee
PROCESS: Compute the value of Tuition fee by multiplying the amount per unit
with the total units to be enrolled. Then compute the value of total fee by adding
the value of tuition fee to the value of miscellaneous and book fee given by the
user. Then calculate the ending balance deducting 30% discount of tuition fee on
the value of total fee.
OUTPUT: Display the value of tuition fee, total fee and the ending balance
Variables: totalUnits, amountPerUnit, miscellaneous, bookFee, tuitionFee,
EndingBalance, discount, totalFee
Formula: tuitionFee := totalUnits * amountPerUnit
discount := 30%0r 0.30
totalFee := tuitionFee + miscellaneous + bookFee
EndingBalance := totalFee – (tuitionFee * 0.3)
Algorithm:
START
Step 1. DECLARE totalUnits, amountPerUnit, miscellaneous, bookFee,
tuitionFee, EndingBalance, discount, totalFee
Step 2. Assign the value of discount into 30%
Step 3. OBTAIN the value of totalUnits, amountPerUnit, miscellaneous,
bookFee
Step 4. Compute the value of tuitionFee by multiplying the amountPerUnit
with the totalUnits. Then compute the value of totalFee by adding the value of
tuitionFee to the value of miscellaneous and bookFee. Then calculate the
EndingBalance by deducting 30% discount of tuitionFee on the value of
totalFee.
Step 5. Display the value of tuitionFee, totalFee and the EndingBalance
STOP
PSEUDOCODE – Sequential Structure
BEGIN
DECLARE totalUnits, amountPerUnit, miscellaneous, bookFee, tuitionFee,
EndingBalance, discount, totalFee
SET discount  0.3
OBTAIN totalUnits, amountPerUnit, miscellaneous, bookFee
CALCULATE:
tuitionFee := totalUnits * amountPerUnit
totalFee := tuitionFee + miscellaneous + bookFee
EndingBalance := totalFee – (tuitionFee * 0.3)
DISPLAY tuitionFee, totalFee, EndingBalance
END

2. Write the pseudo code to determine if the general weighted average of the
student based on his / her grades in prelim, midterm, semi-finals and finals
categorized as academic awardee based on the table below:
General weighted Average category
98-100 With highest Honor
95-97 With High Honor
90-94 With honor
Display the general weighted average and the category.

INPUT: ask the grade value of prelim, midterm, semifinals and finals to the user
PROCESS: calculate the general weighted average by adding first the grade value
of prelim, midterm, semifinals and finals and divide the result by 4.
Determine the category of the general weighted average. If the general weighted
average value is greater than or equal to 98 but not more than 100, then set
category to “With highest Honor”.
If the general weighted average value is greater than or equal to 95 but less than
98, then set category to “With high Honor”. If the general weighted average value
is greater than or equal to 90 but less than 95, then set category to “With Honor”.
OUTPUT:Print the general weighted average and category

VARIABLES: GWA, Category, prelim, midterms, semifinals, finals


FORMULA: GWA = (prelim+midterm+semifinals+finals)/4
PSEUDOCODE – SELECTION
BEGIN
DECLARE Category, prelim, midterms, semifinals, finals
INIT GWA := 0.0
READ prelim, midterms, semifinals, finals
CALCULATE GWA:
GWA := (prelim+midterm+semifinals+finals)/4
DETERMINE Category:
IF GWA ≥ 98 AND GWA ≤ 100 THEN
SET Category = ““With Highest Honor”
ELSE IF GWA ≥ 95 AND GWA < 98 THEN
SET Category = ““With High Honor”
ELSE IF GWA ≥ 90 AND GWA < 95 THEN
SET Category = “With Honor”
ELSE
SET Category = “NON ACADEMIC AWARDEE”
PRINT GWA, Category
END

3. Write the pseudo code that will compute and display the average grade of the
student based on the grade value of his/her ten subjects.

INPUT: Ask the user for the grade value of the ten subjects
PROCESS: Compute the average grade by the dividing the summation of grades
by 10
OUTPUT: AVERAGE GRADE

VARIABLES: average, subjgrade, totalgrade


FORMULA: totalgrade = totalgrade + subjgrade
average = ∑subjGrade / 10

PSEUDOCODE – REPETITION STRUCTUTE


BEGIN
DECLARE average, subjgrade, totalgrade, counter
INIT totalgrade := 0.0, counter := 1
WHILE counter ≤ 10
OBTAIN subjgrade
COMPUTE totalgrade: totalgrade += subjgrade
END WHILE
CALCULATE average: average = totalgrade/10
PRINT average
END

OR

BEGIN
DECLARE average, subjgrade, totalgrade, counter
INIT totalgrade := 0.0, counter := 1
REPEAT
OBTAIN subjgrade
COMPUTE totalgrade: totalgrade += subjgrade
UNTIL counter ≤ 10
CALCULATE average: average = totalgrade/10
PRINT average
END

BEGIN
DECLARE average, subjgrade, totalgrade, counter
INIT totalgrade := 0.0
FOR counter := 1 to counter := 10
OBTAIN subjgrade
COMPUTE totalgrade: totalgrade += subjgrade
END FOR
CALCULATE average: average = totalgrade/10
PRINT average
END
BEGIN
a. DECLARE average, subjgrade, totalgrade, counter
b. INIT totalgrade := 0.0, counter := 1
c. OBTAIN subjgrade
d. COMPUTE totalgrade: totalgrade += subjgrade
e. IF counter <= 10
i. Increment counter to 1
ii. Repeat step c to d
f. ELSE
g. CALCULATE average: average = totalgrade/10
h. PRINT average
END

A BIG NO NO
BEGIN
DECLARE average, subjgrade1, subjgrade2, subjgrade3, subjgrade4,
subjgrade5, subjgrade6, subjgrade7, subjgrade8, subjgrade9, subjgrade10
totalgrade
INIT totalgrade := 0.0
OBTAIN subjgrade1, subjgrade2, subjgrade3, subjgrade4, subjgrade5,
subjgrade6, subjgrade7, subjgrade8, subjgrade9, subjgrade10
CALCULATE average: average = ∑( subjgrade1, subjgrade2, subjgrade3,
subjgrade4, subjgrade5, subjgrade6, subjgrade7, subjgrade8, subjgrade9,
subjgrade10) / 10

PRINT average
END

You might also like