Question: (IncreaseDigits) Consider the following process applied to an ArrayList of Integer. The process replaces each digit 0..9 in the array with a digit one greater,

 (IncreaseDigits) Consider the following process applied to an ArrayList of Integer.
The process replaces each digit 0..9 in the array with a digit
one greater, and 9 is replaced by 0. (Parta) Write a void

(IncreaseDigits) Consider the following process applied to an ArrayList of Integer. The process replaces each digit 0..9 in the array with a digit one greater, and 9 is replaced by 0. (Parta) Write a void method, increaseDigits1, which receives an ArrayList of Integer, and that alters the array such that every digit from 0.9 is replaced with a digit one greater, and 9 is replaced by 0. Example: x 31 4 1 5 9 26 5 35 increaseDigits1(x) will alter the array x as follows. x 4 2 5 2 6 0 3 2 6 4 6 When writing this method, call and write another method called next Digit. The method next Digit(x) takes one integer argument (from 0 to 9), and returns the "next" one. For example, next Digit (6) - 7 and next Digit(9) -0. (Part b) Write another method, increaseDigits, that performs the same action upon the elements of the array passed to it but that does not alter the original array. Instead, the method should return an new ArrayList of Integer containing the result. Example: x 3 1 4 159 26535 increaseDigits2(x) will return a new array as follows. (array x will not be changed] 4 2 5 2 6 0 1 7 64 6 Sample Output: 9, 2, 6, 5, 3, 5 Original Array: Array: 3, 1, 4, 1, 5, Part (a): using increaseDigitsi Array: 4, 2, 5, 2, 6, Part (b): using increaseDigitsi Array: 5, 3, 6, 3, 7, 0, 7. 6, 4, 6 3, 4. 1, 8 7, 5, 7 USIT HTTLISES * CISS ITICT EdseviyIts * */ import java.util.*; public class IncreaseDigits { public static void main(String[] args) { ArrayList x = new ArrayList(): ArrayList y; 17 Array filled with first 11 digits of Pi. double p- Math.PI; for(int i=0; i x ) { int i; System.out.print("Array: "); for(i=0; i

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!