Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Done in Java. Any help is appreciated. 1. Create a class named Lab3Exercises and Implement the following static methods (we will not use this class

image text in transcribed

Done in Java. Any help is appreciated. 1. Create a class named Lab3Exercises and Implement the following static methods (we will not use this class to instantiate objects) and write JUnit tests when asked: a) public static int my 1089Puzzle (int mylnput) i. Implement a function that receives an integer from user in main method) and does the following: Discard all but last 3 digits. Reverse these digits, subtract the original (input) from the reversed (discarding any minus sign), reverse the digits of the difference, and add the difference and the reversed difference. Then return the sum (which should be printed in main). For examples: Input: 371 Reversed: 173 Difference: 198 Reversed: 891 Sum: 1089 For smaller numbers, assume preceding zeros. Few things to remember: Assume only positive integers are the inputs. You can ignore palindrome inputs which return a value of O for difference. For ex., 404. May be return -1. If you get numbers less than 100 after reversal, you should be adding leading zeroes. For ex., 2 should be 002, 99 should be 099. ii. Use the Scanner class to get input from the user in main method) and pass that as a parameter to the method above. Get the returned value and print it along with the user input. iii. After thorough testing, Write appropriate JUnit tests

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago