Question: Problem #3: 120 pts) a) Write a method that returns the difference of number of digits of two integers x and y. The method subtracts

 Problem #3: 120 pts) a) Write a method that returns the

Problem #3: 120 pts) a) Write a method that returns the difference of number of digits of two integers x and y. The method subtracts the number of digits in y from the number of digits in x and returns the value public int Length(int x; int y) For example, if x=24598 and yw415, the number of digits in x is 5, and the number of digits in y is 3. Then the method returns 2 (that is 5-3) For example, if x=234 and y=784415, then the method retums-3 (that is 3-6) b) Write a test program that prompts the user to enter two integers. The program displays whether the first integer has more digits than the second one or less or both have the same number of digits. Sample run 1: Enter two integers: 83456 3433 83456 has more digits than 3433 Sample run 2: Enter two integers: 238 882 238 has the same number of digits as 882 Sample run 3: inter 56993 Problem #3: 120 pts) a) Write a method that returns the difference of number of digits of two integers x and y. The method subtracts the number of digits in y from the number of digits in x and returns the value public int Length(int x; int y) For example, if x=24598 and yw415, the number of digits in x is 5, and the number of digits in y is 3. Then the method returns 2 (that is 5-3) For example, if x=234 and y=784415, then the method retums-3 (that is 3-6) b) Write a test program that prompts the user to enter two integers. The program displays whether the first integer has more digits than the second one or less or both have the same number of digits. Sample run 1: Enter two integers: 83456 3433 83456 has more digits than 3433 Sample run 2: Enter two integers: 238 882 238 has the same number of digits as 882 Sample run 3: inter 56993

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!