Monday 26 August 2013

Update Environment Variables - algorithms

1. The problem is that the environment variables need to be calculated to be updated.
2. The inputs are X, Y, R and T.
3. The outputs are X and Y.
4. The processing tasks are X incremented by R and Y incremented by T.
If X > 5000 then Y decremented by 1000.
If Y < 0, Y and X are set to 0.
5. Pseudocode

Update environment variables
Prompt user for X, Y, R and T

Get X, Y, R and T
X = X + R
Y = Y + T

If X > 5000
Y = Y - 1000

If Y < 0
Y = 0
X = 0

End


No comments:

Post a Comment