1 write a java program firstlastdigitsmath java to accept any non negative integer a 5346985

1. Write a Java program FirstLastDigitsMath.java to accept any non-negative integer as a command line argument, use the Integer.parseInt function to convert this to an int data type, and then compute and print the first and last digits of the number in the format (shown for the example integer 43275):

Using Math methods: Integer: 43275; First Digit: 4; Last Digit: 5

For this problem, you must use methods from the Math class, and not treat the integer as a String or use String class methods.

2. Write a Java program FirstLastDigitsString.java to accept any non-negative integer as a command line argument, but this time treat the integer as a String. Now compute the first and last digits of the number in the format (shown for the example integer 43275) using methods of the String class (not the Math class):

Using Math methods: Integer: 43275; First Digit: 4; Last Digit: 5

3. You’ll find a Java program named TestProgram.java in the folder with the assignment. This program has a main method and runs each program with test inputs. When you are confident that your programs both work, run TestProgram to test them. This program uses the following 5 non-negative integer test inputs:

Test1: 12345; Test2: 044327; Test3: 87931; Test4: 99999; Test5: 0

Your programs should compute and display the correct results for each of these test inputs, or any other non- negative integer input

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now