A program called Rev.java to solve the following problem. The program will optionally take a single three digit integer from the command line, e.g. as follows. $ java Rev 351 If no number is supplied on the command line, then one will be prompted for as follows. $ java Rev Enter a three digit number, with the first digit larger than the third. 351 Either way, if the number is not a three digit number with the first digit larger than the third, an error message must be printed to the console and the program terminated. A typical session will otherwise be as follows. The number regarded as a decimal string is reversed, and the reverse subtracted from the original. You do not have to convert it to a String to achieve this. Details of the sum are displayed as indicated. Similarly, the result of the subtraction has its reverse added to it, and details of that sum are displayed as indicated. Then the program terminates. Note that numbers should be always be reversed as if they have three digits, so e.g. 99 should be treated as 099 and its reverse will be 990. $ java Rev 351 Reverse and subtract: 351 153 - --- 198 Reverse and add: 198 891 + --- 1089
Get Free Quote!
410 Experts Online