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, 21.06.2019 17:00
How can data be added in a table by using what view
Answers: 1
question
Computers and Technology, 22.06.2019 10:40
"it security policy enforcement and monitoring" respond to the following: describe how monitoring worker activities can increase the security within organizations. describe the rationale that managers should use to determine the degree of monitoring that the organization should conduct. explain the extent to which you believe an organization has the right to monitor user actions and traffic. determine the actions organizations can take to mitigate the potential issues associated with monitoring user actions and traffic.
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
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