# writing pseudo-code

Page 1 of 1

## 2 Replies - 9654 Views - Last Post: 31 January 2010 - 10:16 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=152774&amp;s=805ab30e1a81f92f7297de10c907c48a&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 rebego

Reputation: 0
• Posts: 6
• Joined: 17-October 09

# writing pseudo-code

Posted 29 January 2010 - 03:03 PM

My homework question was:
Write the pseudo-code for an If..Then statement that determines the apropriate tax rate for a given annual income level using the guide below:
Under \$20,000 = 2% income tax
\$20,000 - \$50,000 = 5%
\$50,001 - \$75,000 = 10%

This is what i wrote:

If Annual Income is < \$20,000 Then
income tax = 2%
If Annual Income is \$20,000<= \$50,000 Then
income tax = 5%
If Annual Income is \$50,001 <= \$75,000 Then
income tax = 10%

I know this is simple for some but I just want to make sure I'm doing ok. Please advise? Thank you

Is This A Good Question/Topic? 0

## Replies To: writing pseudo-code

### #2 LeisureProgrammer

• N00by VB.NET Developer

Reputation: 110
• Posts: 588
• Joined: 06-September 09

## Re: writing pseudo-code

Posted 29 January 2010 - 03:10 PM

That seems okay - I don't know the syntax of pseudocode, but I think it would be good if you did something like this - and made it seem more code-like.
- Removed spaces from identifiers
- "Fixed" the If statement accoding to VB.NET syntax

```Dim annualIncome as integer = inputbox("What is your annual income?")
Dim incomeTax as integer

If annualIncome < 20000 Then
incomeTax = 2
ElseIf annualIncome >= 20000 and annualIncome <= 50000 Then
incomeTax = 5
ElseIf annualIncome >= 50001 and annualIncome <= 75000 Then
incomeTax = 10
End If

msgbox("The tax rate for the income " & annualIncome & " is " & incomeTax & "%")

```

I'll go off to learn the syntax of pseudo code now

This post has been edited by LeisureProgrammer: 29 January 2010 - 03:17 PM

### #3 MKunstman

Reputation: 8
• Posts: 193
• Joined: 26-October 09

## Re: writing pseudo-code

Posted 31 January 2010 - 10:16 AM

rebego, on 29 Jan, 2010 - 02:03 PM, said:

My homework question was:
Write the pseudo-code for an If..Then statement that determines the apropriate tax rate for a given annual income level using the guide below:
Under \$20,000 = 2% income tax
\$20,000 - \$50,000 = 5%
\$50,001 - \$75,000 = 10%

This is what i wrote:

If Annual Income is < \$20,000 Then
income tax = 2%
If Annual Income is \$20,000<= \$50,000 Then
income tax = 5%
If Annual Income is \$50,001 <= \$75,000 Then
income tax = 10%

I know this is simple for some but I just want to make sure I'm doing ok. Please advise? Thank you

I would say this is fine. You have the concept of what the program would do. If you wanted yes, you could also psuedo in the displays and such but you do not have to. That should be ok.