Contoh Soal
Contoh Soal
Programming problems
Construct a solution algorithm for the following programming problems. To
obtain your final solution, you should:
• define the problem
• group the activities into modules (also consider the data that each module
requires)
• construct a hierarchy chart
• establish the logic of the mainline using pseudocode
• develop the pseudocode for each successive module in the hierarchy
chart
• desk check the solution algorithm.
1. Design an algorithm that will prompt for and accept an employee's annual
salary, and calculate the annual income tax due on that salary. Income tax
is calculated according to the following table and is to be displayed on the
screen.
$5000 to $9999.99 6
$10000 to $19999.99 15
$20000 to $29999.99 20
17
Portion of salary Income tax rate (%)
$30000 to $39999.99 25
18
7. Design an algorithm that will produce a savings account balance report
from a customer savings account file. Each input savings account record
contains the account number, balance forward, deposits (sum of all
deposits), withdrawals (sum of all Withdrawals) and interest earned. Your
program is to read the savings account file and print a detail line for each
savings account record showing account number, balance forward,
deposits, withdrawals, interest earned end final account balance. The final
account balance is calculated as balance forward + deposits – withdrawals
+ interest. A heading is to appear at the top of each page and allowance is
to be made for 45 detail lines per page. At the end of the report, print the
total balances forward. total deposits, total withdrawals, total interest
earned and total final account balances.
8. Design an algorithm that will read a file of sales volume records and print a
report showing the sales commission owing to each salesperson. Each
input record contains salesperson number, name and that person's volume
of sales for the month. The commission rate varies according to sales
volume, as follows:
$200.01-$1000.00 8
$1000.01-$2000.00 10
19
10. At Olympic diving competition level, 10 diving judges award a single mark
(with one decimal place) for each dive attempted by a diving competitor.
This mark can range from a to 10. Design an algorithm that will receive a
score from the 10 judges and calculate the average score. The screen
should display the following output:
Judge 1 2 3 4 5 6 7 8 9 10
Mark 6.7 8.1 5.8 7.0 6.6 6.0 7.6 6.1 7.2 7.0
Score for the dive 6.81
20