Thursday 11 April 2013

Algorithm 2 & Java: Part 1



Problem description:

Each frame, X is incremented by R and Y is incremented by T. If X becomes greater than 5000 then Y is decremented by 1000. If Y becomes less than 0, Y and X are set to 0.

Inputs

R, T, X, Y

Outputs

X, Y

Processing / pseudocode

get/set X = 1000

get/set Y = 900

prompt user for value of R

prompt user for value of T

X += R

Y += T

get R

get T

If X > 5000

Y = Y - 1000

if Y < 0

Y = 0

X = 0

End if

End if

Original Post Mar 26th 2012

No comments:

Post a Comment