Question #42758

A transaction record on a sales commission file contains the retail price of an item sold, a transaction code that indicates the sales commission category to which an item can belong, and the employee number of the person who sold the item. The transaction code can contain the values A, B or C, which indicate that the percentage commission will be 6%, 8% or 10% respectively. Construct an algorithm that will read a record on the file, calculate the commission owing for that record, and print the retail price, commission and employee number.

Expert's answer

Here is the processed document with the code block restored and formatted:

A transaction record on a sales commission file contains the retail price of an item sold, a transaction code which indicates the sales commission category to which an item can belong, and the employee number of the person who sold the item. The transaction code can contain the values A, B or C which indicate that the percentage commission will be 6%, 8% or 10% respectively. Construct an algorithm that will read a record on the file, calculate the commission owing for that record and print the retail price, commission and employee number.

Defining diagram

Solution algorithm

Note that the CASE construct can be user here. In the solution algorithm, if the transaction code is not A, B, or C, then a message will print and the commission will be set to zero.


Process_transaction_record
Read retail_price, trans_code, emp_number
CASE OF trans_codeA: commission = retail_price * 0.06B: commission = retail_price * 0.08C: commission = retail_price * 0.1
    other : DisplayInvalid transaction code, trans_code
            commission = 0
ENDCASE
PrintRetail price:, retail_price,Commission:, commission,Employee Number:, emp_number
END

Desk checking

1. Input data:



2. Expected result:



3. Desk check table:


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS