subject

Write a method rotateArray that is passed to an array, x, of integers (minimum 7 numbers) and an integer rotation count, n. x is an array filled with randomly generated integers between 1 and 100. The method creates a new array with the items of x moved forward by n Elements that are rotated off the array will appear at the end. Forward rotation means moving elements from right to left on paper. For example, suppose x contains the following items in sequence: 1 2 3 4 5 6 7 and the value of n = 3 Your program should first calculate the sum of numbers at even indexes (consider 0 as even) which in this case is 1 + 3 + 5 + 7 = 16, and then average of numbers at odd indexes which in this case is (2 + 4 + 6) / 3 = 4. After that it should make a call to rotateArray with arguments as x and n. Sample output Output Begins The randomly generated integers in array are: 1 2 3 4 5 6 7 Sum of numbers at even indexes = 16 Average of numbers at odd indexes = 4 Enter rotation count: 3 Calling rotateArray with rotation count as 3……… After 1st rotation the array contents are 2 3 4 5 6 7 1 After 2nd rotation the array contents are 3 4 5 6 7 1 2 After 3rd rotation the array contents are 4 5 6 7 1 2 3 End of Output So after rotating by 3, the elements in the new array will appear in this sequence: 4 5 6 7 1 2 3

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
You know the right answer?
Write a method rotateArray that is passed to an array, x, of integers (minimum 7 numbers) and an int...
Questions
question
English, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
Questions on the website: 13722367