A program Rev.java

computer science

Description

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


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.