0

heyy, i'm having problems with this . can anyone help? i really need help to change this into a pseudocode.

Age < 55
Male :
0% tax if annual income < 10 000,
10% tax if 10 000 ≤ annual income ≤ 50 000
20% tax if 50 000 < annual income ≤ 100 000
30% tax if annual income > 100 000
Female :
0% tax if annual income < 12 000,
10% tax if 12 000 ≤ annual income ≤ 55 000
20% tax if 55 000 < annual income ≤ 100 000
30% tax if annual income > 100 000
55 ≤ Age < 80
Male and F
emale:
0% tax if annual income < 20 000,
10% tax if 20 000 ≤ annual income ≤ 70 000
20% tax if 70 000 < annual income ≤ 150 000
30% tax if annual income > 150 000
Age > = 80
Male and Female:
0% tax on all income (No Tax)

3
Contributors
2
Replies
33
Views
1 Year
Discussion Span
Last Post by FC Jamison
1

The thing is, here's the thing. https://en.wikipedia.org/wiki/Pseudocode tells me that for each target language, the format of the psuedocode changes.

HOWEVER for what you wrote, and the tag is "problem" I think what you posted is indeed a form of psuedocode. You could hand that to a few year in the making programmer, tell them the target system (not language today, long story) and they could write your app. So in my mind you have psuedocode.

1

I'm assuming this is an assignment in a beginning programming course. As such, I would look at this problem as a series if nested if statements.

Pseudocode is kind of like writing down programming logic without worrying about syntax. So for this exercise you don't have to know how to write an if...else if...else block of code in whatever language you are learning, you just have to recognize what it is and write it out in a sort of english-coding hybrid sort of way.

For this, what is your top level of items? It is age. So you start out

`if age < 55
        do stuff

    else if age >= 55 and age < 80
        do different stuff

    else
        do other stuff`

Then you look at what the next level of the first if statement is using. Here, it is gender. So now you want to add a second level of if statements.

if age < 55
        if gender=male
                do this
        else
                do that

    else if age >= 55 and age < 80
        do different stuff

    else
            do other stuff

Then look at the third level distinction. This is income level. So you add this step in like so

    if age < 55
            if gender=male
                    if annual income >= 10,000 and annual income <= 50,000
                            tax = 10%
                    else if annual income > 50,000 and annual income <= 100,000
                            tax = 20%
                    else if annual income > 100,000
                            tax = 30%
            else
                    do that

        else if age >= 55 and age < 80
            do different stuff

        else
                do other stuff

That should get you started. You can take it from here.

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.