I have this java project(using eclipse) that calculates check digit numbers. I'm stuck on how to code this one.
The check has a check digit so that it makes the sum of the sights including the check digit divisible by 7. Assume there are always 4 digits plus the check digit. The sample is 3875 with the number being 5 Second trial problem is 5862 and check number needs to be found. How do I go about doing this? I got to entering each digit and adding them but how can i do the rest?
This is for an into to computer science class so please no super complex stuff as if we didn't learn it I cant use it.
My teacher sucks by the way we learn none of this. I already did part a I need part b. Thanks. Here's an image to hell clarify.
First of all, you need to develop some "programmer logic", these problems help to develop it.
Let's break this example:
and the reminder is
3
Let's do the same with the 2nd number on the example:
and the reminder is
3
So, your logic is correct.
In this problem the thing is a little different, you need to sum the digits:
Now you need to get the reminder of
23 / 7
And a reminder of
2
That's your
checkDigit
So the formula is:
mod
7 of the sum