1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhuklara [117]
3 years ago
10

Write a static method reOrder56(int[] nums) that return an array that contains exactly the same numbers as the given array, but

has been reorderd so that every 5 is immediately followed by a 6. You may choose to move every other number with the exception of 5; You are not to move 5. The array contains the same number of 5's and 6's, every 5 has a number after it that is not a 5, and a 6 appears in the array before any 6.
Computers and Technology
1 answer:
denpristay [2]3 years ago
8 0

Answer:

Follows are the code to the given question:

static int[] reOrder56(int[] nums)//defining a static method reOrder56 that holds an array in parameter

{

   int x,y;//defining integer variables

   for(x=0;x<nums.length;x++)//using for loop that counts array  

   {

       if(nums[x]==5 && nums[x+1]!=6) //defining if block checks arry values

       {

           for(y=0;y<nums.length;y++)//use for loop to count array value again  

           {

               if(nums[y]==6 && nums[y-1]!=5)//defining if block checks arry values  

               {

                   nums[y] = nums[x+1];//swap the array element value

                   nums[x+1] = 6;//holing value in array

                   break;//break the condition

               }

           }

       }

   }

}

Explanation:

In this code, a static method "reOrder56" is declared that takes an integer array "nums" in its parameter, and inside the method, two integer variable "x, y" is defined, which is used in the nested loop.

In the first loop, it holds array values and uses the if block to check the array element value and define another loop to check the same condition, and this block, swap the value and holds the value in the array and breaks the condition.

You might be interested in
What does it mean when your phone says system ui has stopped?
wel
It means hat the CPU is taking o much of what the phone can normally do try delete some apps or close apps your not using 
8 0
4 years ago
What is used to accurately position objects on the slide using a single horizontal and vertical line that intersects in the cent
mars1129 [50]
I think its the ruler c
7 0
3 years ago
Read 2 more answers
Ishmael would like to capture a selected potion of his screen and then capture action he performs on that selected portion. What
Natalija [7]

Answer: User the insert screen recording control

Explanation:

Since Ishmael wants to capture a selected potion of his screen l, after which he'll then capture the action that he performs on that selected portion, he should use the insert screen recording control.

It should be noted that on most keyboards, there's an "insert screen" button. Also, Ishmael can simply open the window that he wants to screenshot and then click the screenshot button.

Therefore, the correct option is B.

6 0
3 years ago
Which value can be entered to cause the following code segment to display the message "That number is acceptable."
AnnZ [28]

Answer:

We can give the any  integer value between 10 to 100 then it display the message "That number is acceptable."

Explanation:

In the given code the "number" variable takes an user input via cin .After taking user input it check the condition of if block that the user input is between the range of 10 to 100 .if this condition is true then the statement of if block will be executed i.e  That number is acceptable otherwise else block will be executed That number is not acceptable.

following are the code in c++

#include <iostream> // header file

using namespace std;

int main() // main

{  

   int number; // variable

cin >> number; // taking input

if (number > 10 && number < 100) // if block

cout << "That number is acceptable.";

else

cout << "That number is not acceptable.";

return 0;

}

Output:

66

That number is acceptable.

456

That number is not acceptable.

8 0
4 years ago
You have implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts acces
yulyashka [42]

<u>Client-server</u> implemented a network where hosts are assigned specific roles, such as for file sharing and printing. Other hosts access those resources but do not host services of their own.

<u>Explanation:</u>

The client-server can be utilized on the web just as on a neighborhood (LAN). Instances of customer server frameworks on the web incorporate internet browsers and web servers, FTP customers and servers, and the DNS. Different hosts get to those assets yet don't have administrations of their own. Since it permits arrange permits numerous PCs/gadgets to interface with each other and offer assets.

5 0
4 years ago
Other questions:
  • What can be used to describe and document the analysis and design of complex software systems?
    14·1 answer
  • To change the size of a field or record by dragging its border a.resize b.magnify c.label d.enlarge
    11·2 answers
  • Bloodborne pathogens travel by way of blood cells and can only be spread by person-to-person contact with infected blood
    5·2 answers
  • True or false? Software application packages function as the interface between the operating system and firmware.
    7·1 answer
  • Is this a desktop or a computer, or are they the same thing
    12·1 answer
  • And<br>Why the computer is called dilligent<br>Versatile machine?give long answer ​
    10·1 answer
  • Please please help ASAP it’s timed
    13·1 answer
  • THE DIFFERENCE BETWEEN COPY AND PASTE AND CUT AND PASTE IS: *
    5·2 answers
  • after confirming the removal of a virus from a computer, how should the technician ensure and verify the full functionality of t
    7·1 answer
  • A(n) _____ is a computerized system by which subscribers are able to communicate to all other subscribers by sending a transmiss
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!