These can be tricky problems for many people. Start early!!!
[This is Problem 8 in Savitch's Absolute Java] In cryptarithmetic puzzles, mathematical equations are written using letters to represent digits. Each letter can be a digit from 0 to 9, but no two letters can be the same.The trick is to determine the value of each letter such that the mathematical equation is correct. Here is a sample problem:
SEND + MORE = MONEY
A solution to this puzzle is S=9, R=8, O =0, M=1, Y=2, E=5, N=6, D=7. This is because SEND = 9567, MORE = 1085, and MONEY = 10652, and 9567 + 1085 = 10652.
TOO + TOO + TOO+ TOO = GOOD
You will have to consider how to calculate the value of "GOOD" and "TOO" for given values of T, O, G and D. Your solution should include two public static int functions, good and too. good should take three int parameters--the value of "G", the value of O and the value of D--and should return the integer value of the string GOOD. For example, the function invocation good(5,1,3) should return the integer 5113. The function too should take two int parameters--the value of T and the value of O--and return the value of the string TOO. As hint, here is the header of too:
public static int too(int valueOfT, int valueOfO)
EXTRA CREDIT: Your program prints all solutions to the puzzle. (Yes, there is more than one!)