a sales report. Each record in the file contains a customer's number and name, a sales amount and a tax code. The tax code is to be applied to the sales amount to determine the sales tax due for that sale, as follows:

Tax code Sales tax
0 Tax exempt
1 3%
2 5%

The report is to print a heading 'SALES REPORT', and detail lines listing the customer number, name, sales amount, sales tax and the total amount owing.

Task need to do:

Total amount to match the tax using own creativity and logic.

1. Design algorithm [Note: Pseudocode and Flowchart]

2. Write program and use control structures required

• A DOWHILE loop to control the repetition

• A case structure to calculate the sales tax

Assume that the tax code field has been validated and will only contain a value of 0, 1, or 2.

Design Algorithm:

1. Start
2. Print 'SALES REPORT' as heading
3. Read the customer number, name, sales amount, and tax code for each record from the file
4. Set total amount owing to 0
5. Start a DOWHILE loop to repeat the following steps for each record
6. Calculate sales tax based on the tax code using a case structure:
7. If tax code is 0, set sales tax to 0 (tax exempt)
8. If tax code is 1, calculate sales tax as 3% of the sales amount
9. If tax code is 2, calculate sales tax as 5% of the sales amount
10. Calculate total amount owing as the sum of sales amount and sales tax
11. Print customer number, name, sales amount, sales tax, and total amount owing
12. End DOWHILE loop
13. End

Pseudocode:

1. Print 'SALES REPORT'
2. Read customer number, name, sales amount, and tax code from file
3. totalAmountOwing = 0
4. DOWHILE loop until end of file
5. CASE tax code OF
6. 0:
7. salesTax = 0
8. 1:
9. salesTax = 0.03 * salesAmount
10. 2:
11. salesTax = 0.05 * salesAmount
12. END CASE
13. totalAmountOwing = salesAmount + salesTax
14. Print customer number, name, sales amount, sales tax, total amount owing
15. Read customer number, name, sales amount, and tax code from file
16. End DOWHILE loop

Flowchart:

+------------------+
| Start |
+------------------+
|
|
v
Print 'SALES REPORT'
|
|
v
Read customer number, name,
sales amount, and tax code from file
|
|
v
totalAmountOwing = 0
|
|
v
+-----------------------------+
| DOWHILE Loop |
+-----------------------------+
|
|
v
CASE tax code OF
|
|
v
0: salesTax = 0
|
|
v
1: salesTax = 0.03 * salesAmount
|
|
v
2: salesTax = 0.05 * salesAmount
|
|
v
totalAmountOwing = salesAmount + salesTax
|
|
v
Print customer number, name, sales amount,
sales tax, and total amount owing
|
|
v
Read customer number, name, sales amount,
and tax code from file
|
|
v
+-----------------------------+
| DOWHILE Loop |
+-----------------------------+
|
|
v
|
|
v
+-------------+
| End |
+-------------+

Please note that the pseudocode and flowchart provided above are just a general representation of how to approach the task. You may need to modify them according to the specific programming language and requirements of your task.