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)

Recommended Answers

All 2 Replies

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.

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.

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.