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
WITCHER [35]
4 years ago
9

Write the definition of a function named rotate4ints that is passed four int variables. The function returns nothing but rotates

the values of the four variables: the first variable, gets the value of the last of the four, the second gets the value of the first, the third the value of the second, and the last (fourth) variable gets the value of the third. So, if i, j, k, and m have (respectively) the values 15, 47, 6 and 23, and the invocation rotate4ints(i,j,k,m) is made, then upon return, the values of i, j, k, and m will be 23, 15, 47 and 6 respectively.

Computers and Technology
1 answer:
ivolga24 [154]4 years ago
8 0

Answer:

  1.       public static void rotate4ints(int num1,int num2,int num3,int num4){
  2.        int temp = num1;
  3.        num1 = num4;
  4.        int temp2 =num2;
  5.        num2 = temp;
  6.        int temp3 = num3;
  7.        num3 = temp2;
  8.        num4 = temp3;
  9.        System.out.println("Rotated values "+num1+","+num2+","+num3+","+num4);
  10.    }

Explanation:

This is implemented in Java programming language

Aside the four int variables that will be rotated, three other teporary variables temp1-3 are created to hold temporary values while values are swapped

num1 gets assigned the value of num4, num2 gets assigned the value of num1, num3 gets assigned the value of num2 and num4 gets assigned the of num3.

Pay close attention to the use of the temp variables which are temporary holders of values in-order to swap their values

See a complete java program below with the output attached

<em>public class num8 {</em>

<em>    public static void main(String[] args) {</em>

<em>    int num1 =15; int num2 = 47; int num3 = 6; int num4=23;</em>

<em>        System.out.println("Original Arrangement");</em>

<em>        System.out.println("Rotated values "+num1+","+num2+","+num3+","+num4);</em>

<em>        System.out.println("After Rotation");</em>

<em>        rotate4ints(num1,num2,num3,num4);</em>

<em>    }</em>

<em>    public static void rotate4ints(int num1,int num2,int num3,int num4){</em>

<em>        int temp = num1;</em>

<em>        num1 = num4;</em>

<em>        int temp2 =num2;</em>

<em>        num2 = temp;</em>

<em />

<em>        int temp3 = num3;</em>

<em>        num3 = temp2;</em>

<em>        num4 = temp3;</em>

<em>        System.out.println("Rotated values "+num1+","+num2+","+num3+","+num4);</em>

<em>    }</em>

<em>}</em>

You might be interested in
Write three tasks students can preform in a digital classroom?
Nadya [2.5K]

Students can perform several tasks in a digital environment. For example, they can watch instructional videos, take notes, and participate in peer discussions.

this is the right answer .just did it

7 0
3 years ago
Read 2 more answers
How does a Cloud-first strategy approach a client's migration to the Cloud?by removing outside ecosystem partners from the Cloud
belka [17]

Cloud-first strategies are <em>operating methods</em> wherein teams move all or most of their infrastructure to <em>cloud computing systems</em><em>  </em>such as Web Services, and the further discussion can be defined as follows:

  • It stores assets, including quest and <em>secure resources</em>, in the cloud rather than employing <em>physical resources</em> including such server clusters.
  • This approaches a client's migration to the <em>Cloud by integrating multiple services </em>together to serve the client's business needs.

Therefore, the final answer is "Last choice".

Learn more:

brainly.com/question/1256812

3 0
3 years ago
What wireless channel should I use?
pav-90 [236]
When looking at wireless channels, there are a couple of variables to keep in mind:
The number of other networks using what channels
The strength of the other networks on other channels

So generally speaking, channels 1, 6, and 11 are used by default. The reason for this is because there isn't any adjacent channel interference when you have all of your networks spread out in that manner. If for example, a network was using channel 3, that network would interfere with the signals one channel 1 and 6, and the bandwidth of those channels would have to be shared amongst all of those networks. This isn't optimal. Ideally you should look for a channel with less hosts who have weak signals. I know that in my area, channel 11 is the best channel to be on, because the hosts using that channel have weak signal strengths, which results in a lesser chance of those signals interfering with mine.
4 0
3 years ago
Read 2 more answers
What does it mean "Be Proactive"?
joja [24]

Answer:controlling a situation by making things happen or by preparing for possible future problems

Explanation:

4 0
3 years ago
Read 2 more answers
Populate a stack with ten random integers and empty it by showing that the order of the elements is reversed, from last to first
Anuta_ua [19.1K]

Answer:

class Main {  

 public static void main(String args[]) {

   Deque<Integer> stack = new ArrayDeque<Integer>();

   Random rand = new Random();

   for(int i=0; i<10; i++) {

       int n = rand.nextInt(100);

       System.out.printf("%02d ", n);

       stack.push(n);

   }

   

   System.out.println();

   

   while(stack.size() > 0) {

       System.out.printf("%02d ", stack.removeFirst());

   }

 }

}

Explanation:

example output:

31 18 11 42 24 44 84 51 03 17  

17 03 51 84 44 24 42 11 18 31

4 0
3 years ago
Other questions:
  • How does a Computer chip work?
    6·2 answers
  • Do most of you agree on a primary interpretation? Why?
    14·1 answer
  • Adam has decided to add a table in a Word doc to organize the information better. Where will he find this option? Insert tab, Il
    6·2 answers
  • Describe the difference between cellular, wi-fi and wired networks.
    8·1 answer
  • Which of the following is an individual’s social equals?
    6·1 answer
  • A ________ refers to specific content of a field.
    7·1 answer
  • After Brooke has helped Simon to resolve his original problem, Simon asks her about another linked workbook he has received. The
    7·1 answer
  • Only the one dose audio editors and video editors know this
    9·2 answers
  • Boolean logic deals with statements having one of _____ values.
    13·1 answer
  • They removed my other post but I didn't learn my lesson :)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!