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
In-s [12.5K]
3 years ago
12

Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 then the outp

ut is: 8 3 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int* userVal1, int* userVal2)
Computers and Technology
1 answer:
Ainat [17]3 years ago
4 0

Answer:

public class num3 {

   public static String swapValues(int userVal1, int userVal2){

       int temp = userVal2;

       userVal2 = userVal1;

       userVal1 = temp;

       return(userVal1+", "+userVal2);

   }

   public static void main(String[] args) {

       int val1 = 5;

       int val2 = 8;

       System.out.println("Original values");

       System.out.println(val1+", "+val2);

       System.out.println("Swapped Values");

       System.out.println(swapValues(val1,val2));

   }

}

Explanation:

  • The problem is solved with Java programming language
  • Define the method swapValues() to accept two ints and return a String
  • Within the method body, create a temp variable to hold the value of userVal2 temporary
  • Do the following re-assignment of values userVal2 = userVal1; userVal1 = temp;
  • Return the concatenated String userVal1+", "+userVal2
  • Create two variables and initialize them in the main method
  • Output their values
  • Call swapValues() aand output the swapped values
You might be interested in
In rolling a die four times, what is the odds that at least one 5 would appear?
Ronch [10]

Answer:

The probability that at least one 5 will appear in 4 rolls of die equals \frac{671}{1296}

Explanation:

The given question can be solved by Bernoulli's trails which states that

If probablity of success of an event is 'p' then the probability that the event occurs at least once in 'n' successive trails equals

P(E)=1-(1-p)^{n}

Since in our case the probability of getting 5 on roll of a die equals 1/6 thus we have p = 1/6

Applying the values in the given equation the probability of success in 4 rolls of die is thus given by

P(E)=1-(1-1/6)^{4}=\frac{671}{1296}

4 0
3 years ago
What is a difference between a waxing crescent and a waning gibbous? (1 point) waxing crescent: first quarter waning gibbous: th
iren2701 [21]

Answer:

  waxing crescent: first quarter waning gibbous: third quarter

Explanation:

The moon is waxing (getting larger) in the first quarter after the new moon. It is waning (getting smaller) in the third quarter, after the full moon at the end of the second quarter.

The shape of the moon is a "crescent" when it is less than a semicircle. It is "gibbous" when it is more than a semicircle. As it waxes, the crescent grows until the moon is half-full at the end of the first quarter, then it is a waxing gibbous moon through the second quarter until it is full at the end of the quarter. Following the full moon, it is waning gibbous until it becomes half-full again at the end of the third quarter. Finally, it is a waning crescent through the fourth quarter until the new moon.

  waxing crescent: first quarter waning gibbous: third quarter

5 0
3 years ago
_______________ ________________ have human editors that evaluate, select, and organize websites into a hierarchy of categories.
faust18 [17]

Answer:

wtaf dude?! at least do so on you're own questions! now I lost all of my answers thanks to you bro -_-

Explanation:

6 0
3 years ago
Specifically describe the design process for an Android phone application.
topjm [15]

Answer:

 The designing process of the various android applications is basically done by the XML and then, it is replaced by the HTML in the upcoming years. The XML is used as designing the front end applications in the android.

Wire-framing is the basic process of designing the various type of android applications and its is also called as creating the blueprint in the screen of android application.

The various step of designing the android phone application are as follow:

  • Firstly, define the actual reason of designing the app and then developed the app according to their actual requirement.
  • We must make a background research about the app so that we can innovate something new application to make this application more efficient and reliable.
  • Then, designing the app according the specific requirement and create the proper layout design. Then, build a proper prototype of the application.

7 0
3 years ago
A user can set the security and privacy settings on what is displayed in the message bar from the ________ within the options me
djverab [1.8K]
Depends on the Operating System
6 0
3 years ago
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • Match the number in the picture to the correct Excel interface part. Each number is only used one time.
    11·1 answer
  • 3. Assume a disk drive from the late 1990s is configured as follows. The total storage is approximately 675MB divided among 15 s
    11·1 answer
  • (01.03 LC)
    9·1 answer
  • Why was Apple the best company of 2019??
    15·2 answers
  • Como podemos calcular a média dos valores da Tabela acima no Excel? Assinale a alternativa correta
    11·1 answer
  • Coral Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the a
    6·1 answer
  • Does digital media play a big role in your life?
    13·1 answer
  • Write a program that accepts a whole number as input, multiplies that number by 12, and then outputs the product.
    6·2 answers
  • Why media is far from government​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!