Computer Programming
Activity
- Draw a flowchart to input the employee number, employee name, rate per hour, number of hours worked. Compute and display the basic salary by multiplying the rate per hour and number of hours worked. Compute and display also the SSS deduction which is 20% of the basic salary, Pag-Ibig deduction amounting to 200 pesos, PhilHealth deduction which is 5% of the basic salary, tax deduction which is 16% of the basic salary. Compute and display also the total deductions by adding all deductions (SSS, Pag-Ibig, PhilHealth, and tax). Compute the net pay by subtracting total deductions from basic salary.
Solution
flowchart TD start(["Start"]) init{{name = '''' <br>num = 0<br>rate = 0<br>hour = 0<br>basicSalary = 0<br>sss = 0<br>pagibig = 200<br>philhealth = 0<br>tax = 0<br>netPay = 0<br>deduction = 0<br>}} input[Input num, name, rate, hour] process["basicSalary = rate * hour<br>sss = 0.2 * basicSalary<br>philhealth = 0.05 * basicSalary<br>tax = 0.16 * basicSalary<br>deduction = sss + philhealth + pagibig + tax<br>netPay = basicSalary - deduction<br>"] output[Output basicSalary, sss, pagibig, philhealth, tax, deduction, netPay] terminus(["End"]) start --> init init --> input input --> process process --> output output --> terminus
- Draw a flowchart to input the sustained winds in km per hour and determine the category of typhoon based on the given table below:
| Category | Sustained Winds |
|---|---|
| Tropical Depression | < 62km/h |
| Tropical Storm | 62-88 km/h |
| Severe Tropical Storm | 89-117 km/h |
| Typhoon | 118-220 km/h |
| Super Typhoon | > 220km/h |
Solution
flowchart TD start(["Start"]) init{{"windSpeed = 0"}} input[/"Input windSpeed"/] if220{"windSpeed >= 220"} if118{"windSpeed >= 118"} if89{"windSpeed >= 89"} if62{"windSpeed >= 62"} outTD[/"Output ''Tropical Depression''"/] outTS[/"Output ''Tropical Storm''"/] outST[/"Output ''Severe Tropical Storm''"/] outTY[/"Output ''Typhoon''"/] outSY[/"Output ''Super Typhoon''"/] terminus(["End"]) start --> init init --> input input --> if220 if220 --> |Yes|outSY if220 --> |No|if118 if118 --> |Yes|outTY if118 --> |No|if89 if89 --> |Yes|outST if89 --> |No|if62 if62 --> |Yes|outTS if62 --> |No|outTD outSY & outTY & outST & outTS & outTD --> terminus
- Draw a flowchart to input the price of the product and the quantity. Compute and display the sub total by multiplying the price and the quantity. Calculate the tax which is 12% of sub total and compute the total sales by adding subtotal and tax. Ask the user to input the amount tender, if the amount tender is greater than the total sales, compute the change and display the message “Your change is ” + change, if the amount tend is less than the total sales, display the message “Insufficient amount” and if the amount tender is equal to the total sales, display the message “Thank you for giving an exact amount.”
Solution
flowchart TD start(["Start"]) init{{"price = 0\nquantity = 0\nsubTotal = 0\ntax = 0\ntotalSales = 0\namountTender = 0\nchange = 0\n"}} inputProd[/"Input price, quantity"/] processTotal["subTotal = price * quantity tax = 0.12 * subTotal totalSales = subTotal + tax\n"] outProd[/"Output subTotal, tax, totalSales"/] inputTender[/"Input amountTender"/] hasChange{"amountTender > totalSales"} equalAmount{"amountTender = totalSales"} processChange["change = amountTender - totalSales"] outChange[/"Output ''Your change is '' + change"/] outExact[/"Output ''Thank you for giving an exact amount''"/] outInsufficient[/"Output ''Insufficient amount''"/] terminus(["End"]) start --> init init --> inputProd inputProd --> processTotal processTotal --> outProd outProd --> inputTender inputTender --> hasChange hasChange --> |Yes|processChange processChange --> outChange hasChange --> |No|equalAmount equalAmount --> |Yes|outExact equalAmount --> |No|outInsufficient outChange & outExact & outInsufficient --> terminus
- Draw a flowchart to input three numbers a, b, and c. Output the largest values between a, b, and c.
Solution
graph TD start(["Start"]) init{{"a = 0\nb = 0\nc = 0"}} input[\"Input a, b, c"\] isAHigherB{"a > b"} isBHigherC{"b > c"} isAHigherC{"a > c"} outA[/"Output A"/] outC[/"Output C"/] outB[/"Output B"/] terminus(["End"]) start --> init init --> input input --> isAHigherB isAHigherB --> |Yes|isAHigherC isAHigherB --> |No|isBHigherC isAHigherC --> |Yes|outA isAHigherC --> |No|outC isBHigherC --> |No|outC isBHigherC --> |Yes|outB outA & outB & outC ---> terminus
- Draw a flowchart and input an numeric grade and output the corresponding letter grade using the table below.
| Numeric Grade | Letter Grade |
|---|---|
| 95 - 100 | A |
| 90 - 95 | B |
| 85 - 90 | C |
| 80 - 85 | D |
| 75 - 80 | E |
| below 75 | F |
Solution
graph TB start(["Start"]) init{{"grade = 0"}} input[/"Input grade"/] ifA{"grade >= 95"} ifB{"grade >= 90"} ifC{"grade >= 85"} ifD{"grade >= 80"} ifE{"grade >= 75"} outA[/"Output ''A''"/] outB[/"Output ''B''"/] outC[/"Output ''C''"/] outD[/"Output ''D''"/] outE[/"Output ''E''"/] outF[/"Output ''F''"/] terminus(["End"]) start --> init init --> input input --> ifA ifA --> |Yes|outA ifA --> |No|ifB ifB --> |Yes|outB ifB --> |No|ifC ifC --> |Yes|outC ifC --> |No|ifD ifD --> |Yes|outD ifD --> |No|ifE ifE --> |Yes|outE ifE --> |No|outF outA & outB & outC & outD & outE & outF --> terminus
Performance Task
Draw a flowchart detailing the annual income of an employee.
Compute and display the tax based on the given table below.

Solution
graph TB start(["Start"]) init{{"annualIncome = 0\ntax = 0"}} input[/"Input annualIncome"/] ifHigher25{"annualIncome >= 250000"} ifHigher40{"annualIncome >= 400000"} ifHigher80{"annualIncome >= 800000"} ifHigher200{"annualIncome >= 2000000"} ifHigher800{"annualIncome >= 8000000"} tax0["tax = 0"] tax15["tax = 0.15 * (annualIncome - 250000)"] tax20["tax = 22500 + (0.2 * (annualIncome - 400000))"] tax25["tax = 102500 + (0.25 * (annualIncome - 800000))"] tax30["tax = 402500 + (0.3 * (annualIncome - 2000000))"] tax35["tax = 2202500 + (0.35 * (annualIncome - 8000000))"] output[/"Output tax"/] terminus(["End"]) start --> init init --> input input --> ifHigher25 ifHigher25 --> |Yes| ifHigher40 ifHigher40 --> |Yes| ifHigher80 ifHigher80 --> |Yes| ifHigher200 ifHigher200 --> |Yes| ifHigher800 ifHigher25 --> |No| tax0 ifHigher40 --> |No| tax15 ifHigher80 --> |No| tax20 ifHigher200 --> |No| tax25 ifHigher800 --> |No| tax30 ifHigher800 --> |Yes| tax35 tax0 & tax15 & tax20 & tax25 & tax30 & tax35 --> output output --> terminus