0

Design a program using psuedocode to accept :name, gross salary, personal status, number of children (50employees)
Calculate and print: name, gross salary, income tax for all
Rules: personal allowance $12000 single person $23,000 married. child allowance $1000 per child. Taxabl;e income gross salary- personal allowance and child allowance.
Income tax RUles
10000 and under= no tax
greater than 10000 less than 20000 =20%
greater than 20000, less than 40000 = 30%
above 40000 = 40%

OK guys here's what i have

Start
Declare name, salary, status, children, allowance, taxable_income, income_tax, child_allowance
For 1 to 50
Write "name"
Read Name
Write "gross salary"
Read salary
Write "personal status (married/single)"
Read status
Write "number of children"
Read child
If status=single THEN
Allowance=$12000
ELSE
Allowance=$23000
ENDIF
child_allowance = $1000*child
taxable_income = gross_salary-(Allowance+child_allowance)
If taxable_income =< 10000 THEN
Write "no tax deducted"
ELSE
If taxable_income >10000 and <20000 THEN
income_tax =.20*taxable_income
ELSE
If taxable_income >20000 and <40000 THEN
income_tax = .30*taxable_income
ELSE
If taxable_income > 40000 THEN
income_tax = .40*taxable_income
ENDIF
ENDIF
ENDIF
Write “The person’s name is” name
Write “The person’s gross_salary is” salary
Write “The persons Income Tax is” income_tax
ENDFOR
STOP

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Momerath
0

Do you need to pay attention to case? Your variable declarations don't all match variables in the pseudo-code (allowance versus Allowance, why "Start" but "STOP", "If" but "ENDIF", "Declare" and not "DECLARE"?)

0

Do you need to pay attention to case? Your variable declarations don't all match variables in the pseudo-code (allowance versus Allowance, why "Start" but "STOP", "If" but "ENDIF", "Declare" and not "DECLARE"?)

Here's the correction
Start
DECLARE name, salary, status, children, allowance, taxable_income, income_tax, child_allowance
FOR 1 to 50
WRITE "name"
READ Name
WRITE "gross salary"
READ salary
WRITE "personal status (married/single)"
READ status
WRITE "number of children"
READ child
IF status=single THEN
allowance=12000
ELSE
allowance=23000
ENDIF
child_allowance = 1000*child
taxable_income = gross_salary-(allowance+child_allowance)
IF taxable_income =< 10000 THEN
WRITE "no tax deducted"
ELSE
IF taxable_income >10000 and <20000 THEN
income_tax =.20*taxable_income
ELSE
IF taxable_income >20000 and <40000 THEN
income_tax = .30*taxable_income
ELSE
income_tax = .40*taxable_income
ENDIF
ENDIF
ENDIF
WRITE “The person’s name is” name
WRITE “The person’s gross_salary is” salary
WRITE “The persons Income Tax is” income_tax
ENDFOR
STOP

0

Well, overall it seems at least reasonably correct. I've never cared to do pseudo code myself: I just code a simple frame of what I need, then add testing and actual code until it is all done. Since you have to do it to your prof's standards, I'm really not a good resource for that. But the flow is appropriate.

0

Well, overall it seems at least reasonably correct. I've never cared to do pseudo code myself: I just code a simple frame of what I need, then add testing and actual code until it is all done. Since you have to do it to your prof's standards, I'm really not a good resource for that. But the flow is appropriate.

.lol ok thnks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.