This assignment requires you to use at least one loop and an array. You can refer...

90.2K

Verified Solution

Question

Programming

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 atthe beginning of your program with your name and your birthday(month and day, does not need to include year). For example: JohnDoe, May 23. Create an array that will store whole numbers. Thesize of the array should be ten more than the month number of yourbirthday. Continuing the example, for a birthday in May, the arraywill be of size 15 since May is the fifth month and 5 + 10 = 15.Then let the user enter each value to store in the array. Performinput validation that the user enters numbers between 1 and the dayof the month that is your birthday. (That is, a value is invalid ifis less than 1. Similarly, a value is invalid if it is greater thanthe day of the month that is your birthday.) Continuing theexample, for a birthday on the 23 of the month, the valid valuesthe user can enter are 1 through 23. Go through the array andcollapse the array into a single representative number as follows:i. First replace every three adjacent integers with the sum of thetwo numbers. For example, if the first three elements of the arrayare 1, 2, and 3, they become the single value of 6. For example [1,2, 8, 9, 4, 13, 7, 1, 9, 10, 5] becomes [11, 26, 17, 15] ii. Gothrough the new array and modify any number that is larger than 12to be the difference between it and 12. (You can use eithersubtraction or modulus for this.) Continuing the example, [11, 26,17, 15] becomes [11, 14, 5, 3] Then iteratively continue collapsingthe array until you have a single representative integer.Continuing the example: Add adjacent three integers in [11, 14, 5,3] to get [30, 3] Then change it to become [18, 3] Add adjacentthree integers in [18, 3] to get the single value of 21 which ismodified to be 9 and the result is displayed to the user

Answer & Explanation Solved by verified expert
4.0 Ratings (631 Votes)
Deepesh Malhotra Jan 31 This code is in C    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students