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
50PTS!! does anyone know how you turn in a section of your slides my teacher wants us to turn in only a portion of our google sl
HACTEHA [7]

Answer:

The best way to turn in one part of google slides, since you can't split the slide when turning assignments on classroom, is to copy and paste the part you want to turn in into another slide and submit that portion. I've done for many projects before and if you name the different slides (Ex: Assignment Portion One 5/6/20) so it won't get confusing with the multiple slides.

This is the best way I can think of, I hope I helped, and please correct me if there is a better way!

5 0
3 years ago
Filtering removes data from the spreadsheet. A. True B. False
____ [38]
6 is false
7 is false
8 is true
5 0
3 years ago
Read 2 more answers
For each of the following memory accesses indicate if it will be a cache hit or miss when carried out in sequence as listed. Als
nika2105 [10]

Answer:

Explanation:

Operation Address Hit? Read Value

Read 0x834 No Unknown

Write 0x836 Yes (not applicable)

Read 0xFFD Yes CO

6 0
3 years ago
Another method that might be desired is one that updates the Student's number of credit hours. This method will receive a number
statuscvo [17]

Answer:

Option d is the method

Explanation:

public void update Hours(int more Hours)

{

hours += more Hours;}e. public int update Hours(int more Hours){return hours + more Hours;

}

5 0
3 years ago
1. Why is it important to evaluate the website on which you plan to shop? (1 point)
UkoKoshka [18]
Hi there!

For #1 the answer is the site may not be trustworthy, and you risk identity theft. If you are not sure a site legit then don't trust it. Some sites can easy to tell if they can be trusted by the amount of detail put into the site itself, but others are not so easy to tell. In general, if a site does not have https:// in the web address, but instead has just http:// (no "s" in it) then don't trust it.

For #2 the answer is to use<span> a secure browser. If the browser you are using is insecure then the info you put into a site can be compromised and stolen by the browser itself because it reads all info put on it.

For #3 the answer is i</span><span>t has a secure payment page. Again going back to the https:// vs. the http:// if the page that you pay on is not secured then your credit card info can be stolen when put in because the site without a secured page will allow others with access to see your info.

-Your friend in tech, </span>ASIAX   Frequent Answerer
8 0
3 years ago
Read 2 more answers
Other questions:
  • Write a cout statement that prints the value of a conditional expression. The conditional expression should determine whether th
    7·1 answer
  • Which information technology job has the lowest predicted 10-year growth? computer programmer software developer computer suppor
    13·1 answer
  • Why ues storage unit?​
    12·1 answer
  • How to know if somebody else is listening my conversations by cellphone?
    13·1 answer
  • If a function needs to return more than one value, as a rule of good programming style, you should change it to a(n) ___________
    6·1 answer
  • Mathematical expression that might link numbers in cells
    14·1 answer
  • Did anyone else remember that Unus Annus is gone? I started crying when I remembered.... Momento Mori my friends.... Momento Mor
    9·2 answers
  • Choose the type of collection described.
    9·1 answer
  • What do I have to do to get you to cancel this subscription? I have emailed several times and every dang month I get a $10 charg
    10·1 answer
  • The action of entering data into your computer. This can be text typed in a word processing document, keywords entered in a sear
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!