Here is my homework assignment. So far I have a very clear understanding on what I need to do. I just need some hints or ideas.
Write a program that requests a 4-digit integer and displays the digits one at a time. For example,
given 7294, your program should print:
First digit: 7
Second digit: 2
Third digit: 9
Fourth digit: 4
Hint: use the % and / operations to extract the digits.
Okay, I know I will use modules operators and division(From what the professor has told me). I will use a scanner class and ask four a four digit INT number. But I don't know how to explain this in java code.
7 % 7294 = 7
2 % 7294 = 2
9 % 7294 = 9
4 % 7294 = 4
Ask you can see if you use the mod operation on a specific digit from the four digit number. Then you will have the reminder which you can output. But I don't know how to tell java to take a particular from that four digit number. Any suggestions guys?
Know thy enemy and it becomes a lot less fearsome…
--- Update ---