I am a student who is taking a computer science course in college and have been assigned to write an algorithm for a java program. I have no previous programming experience and I am really behind in this class. It seems fairly simple and anyone on here could probably do it with their eyes closed. I have to write an algorithm dealing with incomes and income taxes so far i have (see below) but do not know where to go from there. As you can see its basic fudamentals of java but i have no clue what i am doing, any help would be greatly appreciated.

Done>false
Read(income)
If(income ==-1)
Done>true
While(!done)
If(income <= 15000)

This is not java. And during your class, have you learned to write classes with main method and run the "Hello World" program?

class Hello {
 public static void main(String [] args) {
  system.out.println(Hello World);
 }
}

I know this is not java but my professor wants a simple algorithm written for our program before we actually start writing code for it. no ive never been taught the hello world program

Done>false
Read(income)
If(income ==-1)
Done>true
While(!done)
If(income <= 15000)

Done>false
While(!done)
Read(income)
If(income ==-1)
Done>true
Else
//calculate the income tax
EndIf
EndWhile


First you go inside the while loop:
Done>false
While(!done)

EndWhile


Then you read the income. If it is equals to -1 then done is set to true so you will leave the loop. Else do the calculations and repeat. But I would suggest to change the: '==-1' to '<=0'

This article has been dead for over six months. Start a new discussion instead.