by **thomas_w_bowman** » Wed Sep 22, 2004 9:46 am

So, an assignment...I'll try to help without doing it for you...by breaking down some implicit functional requirements:

User-entered value has a length, set a variable to that length-1

set a one-character to the value at (length-1)

Check that single-character variable for valid numeric value (yes, you may have defined input as numeric, but this way it'll never crash because of any change(s).)

Convert the character to a numeric value, divide it by seven (or "if less than 7 - it's already a remainder - else if it's 7 or more subtract 7 and the result is a remainder). For larger intigers, divide by seven - forcing answer to a integer-only value, then multiply that value by 7 and subtract it from the original number to obtain the remainder (making sure that you use integer type numerics for all of this, it would get messy if using a floating point number or any decimal places).

Now turn the requirement into Java.