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

Recommended Answers

All 6 Replies

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"?)

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

overall does it seem correct?

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.

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

What tax do you pay if your income after deductions is exactly 20000?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.