This assignment requires you to use at least one loop and anarray. You can refer to our book and any programs you have writtenso far. Make sure that your work is your own.
Write a comment at the beginning of your program with your nameand your birthday (month and day, does not need to include year).For example: John Doe, May 23
Create an array that will store whole numbers. The size of thearray should be ten more than the month number of your birthday.Continuing the example, for a birthday in May, the array will be ofsize 15 since May is the fifth month and 5 + 10 = 15.
Then let the user enter each value to store in the array.Perform input validation that the user enters numbers between 1 andthe day of the month that is your birthday. (That is, a value isinvalid if is less than 1. Similarly, a value is invalid if it isgreater than the day of the month that is your birthday.)Continuing the example, for a birthday on the 23 of the month, thevalid values the user can enter are 1 through 23
Go through the array and collapse the array into a singlerepresentative number as follows:
i. First replace every three adjacent integers with the sum ofthe two numbers. For example, if the first three elements of thearray are 1, 2, and 3, they become the single value of 6. Forexample [1, 2, 8, 9, 4, 13, 7, 1, 9, 10, 5] becomes [11, 26, 17,15]
ii. Go through the new array and modify any number that islarger than 12 to be the difference between it and 12. (You can useeither subtraction or modulus for this.) Continuing the example,[11, 26, 17, 15] becomes [11, 14, 5, 3]
Then iteratively continue collapsing the array until you have asingle representative integer. Continuing the example: Add adjacentthree integers in [11, 14, 5, 3] to get [30, 3] Then change it tobecome [18, 3] Add adjacent three integers in [18, 3] to get thesingle value of 21 which is modified to be 9 and the result isdisplayed to the user.
Some tips: ï‚· Try this process with more than 1 array as input tomake sure it really works! ï‚· If you are finding this confusing ordifficult, begin with getting input from user and performing thefirst iteration of adding adjacent pairs of integers.
Programming code should be written in Java Language thankyou