Computer Science Assignment: Calculating Commission, Grades, and Tax
VerifiedAdded on 2023/06/09
|10
|1002
|348
Homework Assignment
AI Summary
This computer science assignment solution addresses three distinct problems. The first problem involves calculating commission based on retail price, employee ID, and transaction code, including a validation check for transaction codes and a desk check for testing. The second problem focuses on calculating student grades based on their scores, using a defined grading scale and providing desk check examples. The final problem requires calculating the tax payable based on an employee's income, applying a progressive tax bracket system with multiple tiers and including desk check testing to verify the output. Each problem includes pseudo-code, expected outputs, and desk check tables to demonstrate the logic and expected results.

Running head: INTRODUCTION TO COMPUTER SCIENCE
Introduction to Computer Science
Name of the student:
Name of the University:
Author note:
Introduction to Computer Science
Name of the student:
Name of the University:
Author note:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

1
INTRODUCTION TO COMPUTER SCIENCE
Question 1
Problem Description
The user is to enter the retail price of a sold item, the employee number of the employee who is
dealing with the sale and the transaction code. The program shall check if the transaction code is
valid or not. Furthermore, the program will calculate the commission price of the item based on
the provided chart: A: 6%, B: 8%, C: 10%
Pseudo Code
Start
1. Enter Retail Price
2. While transaction code invalid
a. Enter Transaction Code
b. If Transaction Code not in range ‘A’, ‘B’ or ‘C’
i. Display Error Message
c. Else break out of while loop
3. Enter Employee Number
4. Display Retail Price
5. Display Employee Number
6. If Transaction Code = ‘a’ or ‘A’
a. Commission = 6/100*Retail Price
7. Else if Transaction Code = ‘b’ or ‘B’
a. Commission = 8/100*Retail Price
8. Else
INTRODUCTION TO COMPUTER SCIENCE
Question 1
Problem Description
The user is to enter the retail price of a sold item, the employee number of the employee who is
dealing with the sale and the transaction code. The program shall check if the transaction code is
valid or not. Furthermore, the program will calculate the commission price of the item based on
the provided chart: A: 6%, B: 8%, C: 10%
Pseudo Code
Start
1. Enter Retail Price
2. While transaction code invalid
a. Enter Transaction Code
b. If Transaction Code not in range ‘A’, ‘B’ or ‘C’
i. Display Error Message
c. Else break out of while loop
3. Enter Employee Number
4. Display Retail Price
5. Display Employee Number
6. If Transaction Code = ‘a’ or ‘A’
a. Commission = 6/100*Retail Price
7. Else if Transaction Code = ‘b’ or ‘B’
a. Commission = 8/100*Retail Price
8. Else

2
INTRODUCTION TO COMPUTER SCIENCE
a. Commission = 10/100*Retail Price
9. Display Commission
Stop
Desk Check testing
Input: Employee ID- 159357, Transaction ID- C, retail price- 100
Expected Output: 10
Sl. no. Retail Price Transaction ID Employee
No.
Commission Display
Output
1 100
2.a. C
3 159357
4 100
5 159357
…
8.a 10/100*100=10
9 10
Input: Employee ID- 159357; Transaction ID- A; Retail price- 50;
Expected Output: 3
Sl. no. Retail Price Transaction ID Employee Commission Display
INTRODUCTION TO COMPUTER SCIENCE
a. Commission = 10/100*Retail Price
9. Display Commission
Stop
Desk Check testing
Input: Employee ID- 159357, Transaction ID- C, retail price- 100
Expected Output: 10
Sl. no. Retail Price Transaction ID Employee
No.
Commission Display
Output
1 100
2.a. C
3 159357
4 100
5 159357
…
8.a 10/100*100=10
9 10
Input: Employee ID- 159357; Transaction ID- A; Retail price- 50;
Expected Output: 3
Sl. no. Retail Price Transaction ID Employee Commission Display
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3
INTRODUCTION TO COMPUTER SCIENCE
No. Output
1 50
2.a. A
3 159357
4 50
5 159357
…
8.a 6/100*50=3
9 3
Question 2
Problem Description
The program intends to take input of the score of a student and calculate the Grades of the
student based on the following criteria:
Pseudo Code
Start
1. Enter Serial Number
INTRODUCTION TO COMPUTER SCIENCE
No. Output
1 50
2.a. A
3 159357
4 50
5 159357
…
8.a 6/100*50=3
9 3
Question 2
Problem Description
The program intends to take input of the score of a student and calculate the Grades of the
student based on the following criteria:
Pseudo Code
Start
1. Enter Serial Number
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

4
INTRODUCTION TO COMPUTER SCIENCE
2. While Score not in range 0-100
a. Enter Score
b. If score < 0 or score > 100
i. Display error message
3. If Score >= 85
a. Grade = “HD”
4. If Score >= 75
a. Grade = “D”
5. If Score >= 65
a. Grade = “C”
6. If Score >= 50
a. Grade = “P”
7. Else
a. Grade = “F”
8. Display Grade
Stop
INTRODUCTION TO COMPUTER SCIENCE
2. While Score not in range 0-100
a. Enter Score
b. If score < 0 or score > 100
i. Display error message
3. If Score >= 85
a. Grade = “HD”
4. If Score >= 75
a. Grade = “D”
5. If Score >= 65
a. Grade = “C”
6. If Score >= 50
a. Grade = “P”
7. Else
a. Grade = “F”
8. Display Grade
Stop

5
INTRODUCTION TO COMPUTER SCIENCE
Desk Check Testing
Input: 75
Expected Output: D
Sl no. Score Grade Output
1 75
2
3
4 D
Input: 55
Expected Output: P
Sl no. Score Grade Output
1 55
2
…
6 P
Question 3
Problem Description
This program takes input of the income of an employee and then calculate and display the tax
payable based on the following chart:
INTRODUCTION TO COMPUTER SCIENCE
Desk Check Testing
Input: 75
Expected Output: D
Sl no. Score Grade Output
1 75
2
3
4 D
Input: 55
Expected Output: P
Sl no. Score Grade Output
1 55
2
…
6 P
Question 3
Problem Description
This program takes input of the income of an employee and then calculate and display the tax
payable based on the following chart:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

6
INTRODUCTION TO COMPUTER SCIENCE
Pseudo Code
Start
1. Enter income
2. Tax payable = 0
3. If income > 20000 and >= 30000
a. Tax Payable = Tax Payable+2% of 10000
4. Else if income > 20000
a. Tax Payable = Tax Payable+2% of (income-20000)
5. If income > 30000 and >= 40000
a. Tax Payable = Tax Payable+3.5% of 10000
6. Else if income > 30000
a. Tax Payable = Tax Payable+3.5% of (income-30000)
INTRODUCTION TO COMPUTER SCIENCE
Pseudo Code
Start
1. Enter income
2. Tax payable = 0
3. If income > 20000 and >= 30000
a. Tax Payable = Tax Payable+2% of 10000
4. Else if income > 20000
a. Tax Payable = Tax Payable+2% of (income-20000)
5. If income > 30000 and >= 40000
a. Tax Payable = Tax Payable+3.5% of 10000
6. Else if income > 30000
a. Tax Payable = Tax Payable+3.5% of (income-30000)
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7
INTRODUCTION TO COMPUTER SCIENCE
7. If income > 40000 and >= 80000
a. Tax Payable = Tax Payable+7% of 40000
8. Else if income > 40000
a. Tax Payable = Tax Payable+7% of (income-40000)
9. If income > 80000 and >= 120000
a. Tax Payable = Tax Payable+11.5% of 40000
10. Else if income > 80000
a. Tax Payable = Tax Payable+11.5% of (income-80000)
11. If income > 120000 and >= 160000
a. Tax Payable = Tax Payable+15% of 40000
12. Else if income > 120000
a. Tax Payable = Tax Payable+15% of (income-120000)
13. If income > 160000 and >= 200000
a. Tax Payable = Tax Payable+18% of 40000
14. Else if income > 160000
a. Tax Payable = Tax Payable+18% of (income-160000)
15. If income > 200000 and >= 240000
a. Tax Payable = Tax Payable+19% of 40000
16. Else if income > 200000
a. Tax Payable = Tax Payable+19% of (income-200000)
17. If income > 240000 and >= 280000
a. Tax Payable = Tax Payable+19.5% of 40000
18. Else if income > 240000
INTRODUCTION TO COMPUTER SCIENCE
7. If income > 40000 and >= 80000
a. Tax Payable = Tax Payable+7% of 40000
8. Else if income > 40000
a. Tax Payable = Tax Payable+7% of (income-40000)
9. If income > 80000 and >= 120000
a. Tax Payable = Tax Payable+11.5% of 40000
10. Else if income > 80000
a. Tax Payable = Tax Payable+11.5% of (income-80000)
11. If income > 120000 and >= 160000
a. Tax Payable = Tax Payable+15% of 40000
12. Else if income > 120000
a. Tax Payable = Tax Payable+15% of (income-120000)
13. If income > 160000 and >= 200000
a. Tax Payable = Tax Payable+18% of 40000
14. Else if income > 160000
a. Tax Payable = Tax Payable+18% of (income-160000)
15. If income > 200000 and >= 240000
a. Tax Payable = Tax Payable+19% of 40000
16. Else if income > 200000
a. Tax Payable = Tax Payable+19% of (income-200000)
17. If income > 240000 and >= 280000
a. Tax Payable = Tax Payable+19.5% of 40000
18. Else if income > 240000

8
INTRODUCTION TO COMPUTER SCIENCE
a. Tax Payable = Tax Payable+19.5% of (income-240000)
19. If income > 280000 and >= 320000
a. Tax Payable = Tax Payable+20% of 40000
20. Else if income > 280000
a. Tax Payable = Tax Payable+20% of (income-280000)
21. If income > 320000
a. Tax Payable = Tax Payable+22% of 40000
22. Display Income and Tax Payable
Stop
Desk Check Testing
Input Income: 80000
Expected output: 3350
Sl. No. Income Tax Payable Output
1 80000
2 0
3 0+2%10000=200
4
5 200+3.5%10000=550
6
7 550+7%4000=3350
8
INTRODUCTION TO COMPUTER SCIENCE
a. Tax Payable = Tax Payable+19.5% of (income-240000)
19. If income > 280000 and >= 320000
a. Tax Payable = Tax Payable+20% of 40000
20. Else if income > 280000
a. Tax Payable = Tax Payable+20% of (income-280000)
21. If income > 320000
a. Tax Payable = Tax Payable+22% of 40000
22. Display Income and Tax Payable
Stop
Desk Check Testing
Input Income: 80000
Expected output: 3350
Sl. No. Income Tax Payable Output
1 80000
2 0
3 0+2%10000=200
4
5 200+3.5%10000=550
6
7 550+7%4000=3350
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

9
INTRODUCTION TO COMPUTER SCIENCE
…
22 3350
INTRODUCTION TO COMPUTER SCIENCE
…
22 3350
1 out of 10

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.