Name Of The Student Name Of The University Author S Note Solution Algorithm 1 Defini 2922229
Name of the Student
Name of the University
Author’s Note
Solution Algorithm 1:
Defining Problem:
Input
Processing
Output
Recording transaction Retail_cost Transaction_code Employee_No.
Reading transaction Calculating commission Printing details of transaction
Retail cost Commission Employee No.
Pseudo code algorithm:
If the case of solution is not A, B or C then a message is printed and commission set as 0.
Process transaction record
Read retail_cost, transaction_code and employee_no.
CASE Transaction_Code
A: Commission = retail_cost x 0.06
B: Commission = retail_cost x 0.08
C: Commission = retail_cost x 0.1
Other: Displaying ‘Invalid transaction’, Transaction_code commission = 0
END CASE
Print ‘Retail Price’, retail_cost, ‘Commission’, commission, ‘Employee No.’, Employee_No.
END
Desk check of the algorithm:
INPUT:
1 st Set of Data 2 nd Set of Data Retail_cost 50$ ABC Transaction_code A C Employee_No. 12345 34567
Result Expected
1 st Set of Data 2 nd Set of Data Commission 3$ ERROR
Check Table
Statement No.
Retail_Price
Transaction_Code
Emloyee_No.
Commission
1 st Pass
50$
A
12345
3$
2 nd Pass
ABC
C
34567
ERROR
Solution Algorithm 2:
Defining Problem:
Input
Processing
Output
serial_no.
Analyse student record
serial_no.
exam_point
Computing grade_letter
exam_point
Print detailed result
grade_letter
Pseudo code algorithm:
Using nested IF framework and CASE statement
Process_student_grade_letter
Read_student_serial_no., student_exam_marks
CASE of grade_letter
HD: exam_marks>84
D: exam_marks>74
C: exam_marks>64
P: exam_marks>59
F: exam_marks
ENDCASE
Print student_serial_no., exam_marks, grade_letter
End
Using linear nested IF statement:
Process_student_grade_letter
Read_student_serial_no., student_exam_marks
IF exam_marks > ’84’ THEN
exam_marks = HD
ELSE
IF exam_marks > ’74’; THEN
exam_marks = D
ELSE
IF exam_marks > ‘64’ THEN
exam_marks = C
ELSE
IF exam_marks > ‘59’ THEN
exam_marks = P
ELSE
IF exam_marks ‘50’ THEN
exam_marks = F
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
exam_marks = grade_letter
Print student_serial_no., exam_marks, grade_letter
End
Desk check of the algorithm:
INPUT:
1 st set of data
2 nd Set of data
Exam_marks
77
AD
Grade_letter
D
HD
Result Expected
1 st set of data
2 nd Set of data
Exam_marks
77
Invalid
Grade_letter
D
HD
Check Table
Statement
exam_marks
Grade_ letter
Execution of CASE statement
1 st Pass
Read
77
CASE
CASE D
Grade_letter
D
yes
yes
2 nd Pass
Read
AD
CASE
Grade_letter
yes
yes
Solution Algorithm 3:
Defining Problem:
Two integer items are taken into a loop using an array for calculating the income from the user and computing the income tax and displaying the income tax. The chargeable income, income tax and gross tax payable is analysed for checking the validation and optimizing the codes.
Input
Processing
Output
Integer 1 Integer 2
Sum Difference Product Quotient
Display
Pseudo code algorithm:
Calculating_payable_tax
Prompt for income
Get income
If (income >=0 & income =20,000)>
Print Tax = 0
Else if (income >= 20,000 & income =30,000)>
Then
Print tax = 0 + (income -20,000) *2%
Else if (income >= 30,000 & income =40,000)>
Then
Print tax = 200+ (income – 30,000) *3.5%
Else if (income >= 40,000 & income =80,000)>
Then
Print tax = 550+ (income – 40,000) * 7%
Else if (income >= 80,000 & income =120,000)>
Then
Print tax = 3,350+ (income – 80,000) *11.5%
Else if (income >= 120,000 & income =160,000)>
Then
Print tax = 7,950+ (income – 120,000) *15%
Else if (income >= 160,000 & income =200,000)>
Then
Print tax = 13,950+ (income – 160,000) *17%
Else if (income >= 200,000 & income =320,000)>
Then
Print tax = 20,750+ (income – 200,000) *18%
Else if (income >= 320,000)
Then
Print tax = 42,350+ (income – 320,000) *20%
Desk check of the algorithm:
INPUT:
1 st Set of Data 2 nd Set of Data income 320,500 AB income 160,500 0
Result Expected:
1 st Set of Data
2 nd Set of Data
Tax
50,920
Error
Tax
16406.5
Error
Check Table:
Statement
Income
Tax
1 st Pass
1, 2
Get /Prompt
320500
3
Check
4
Calculate
5
50,920
2 nd Pass
1, 2
Get /Prompt
AB
3
Check
4
Calculate
5
Error
Bibliography
Adulyasak, Y., Cordeau, J. F., & Jans, R. (2015). The production routing problem: A review of formulations and solution algorithms. Computers & Operations Research , 55 , 141-152.
Gunawan, A., Lau, H. C., & Vansteenwegen, P. (2016). Orienteering problem: A survey of recent variants, solution approaches and applications. European Journal of Operational Research , 255 (2), 315-332.