Question: Implement the following method that returns a suffix of an integer with a specified number of digits. /** For example, getSuffix(12345, 2) should return 45

Implement the following method that returns a suffix of an integer with a specified number of digits.

/** For example, getSuffix(12345, 2) should return 45 and getSuffix(1234567, 3) returns 567 */

public static int getSuffix(int value, int numberOfDigits) {

/*Hint: Don't use Math.pow method, because using it will cause inaccuracy for integer operations */

You should then write a test program using a main method to test this method with inputs of (5323462, 3) and (9876543, 4).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!