Question: Using java to do the following task, only using simple arithmetic method to complete, no loop please 4t Interprets the integer provided as an
4t " Interprets the integer provided as an octal number and adds the five octal digits together. " If there are more than 5 octal digits in the number, only the last 5 will be added " For example, octal 01745 (which is equivalent to decimal 997) would result in " 0 + 1 + 7 +4 + 5 17 (in decimal). * eparam fiveoctalDigitNum the integer that will used as an octal number. * ereturn the last five octal digits in the argument added together. 9 eublic static int addoctalDigits(int fiveoctalDigitNum)( // Hint: division and remainder allows you to get the right most digit and remove // the right most digit from a number // For example: 997 % 10 = 7 (Remainder after division by 1.) similarly, to remove the last 6:-1 // digit 997 / 10 = 99 (integer division result in the whole number that results from the 7/ division. 8 II You can do the same to get the right most octal digit and remove the right most octal digit. 9 /But you would divide by 8 (for base 8) instead of 10 (for base 10). 8 // Hint: You can assume 5 digits. Using the above hint, work from right to left when adding
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
