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
Andrew [12]
3 years ago
8

Write a method, findMax(), that takes in two integers and returns the largest value. Ex: If the program input is: 4 2 the method

findMax() returns: 4 Note: Your program must define the method: public int findMax(int num1, int num2)
Computers and Technology
1 answer:
olya-2409 [2.1K]3 years ago
4 0
<h2>Answer:</h2><h2></h2>

public int findMax(int num1, int num2){

      if(num1 > num2){

           return num1;

      }

 

      else {

          return num2;

      }

}

<h2>Explanation:</h2>

<em></em>

The code has been written in Java and the following explains every part of the code.

<em>i. Start with the method header:</em>

<em>public int findMax(int num1, int num2)</em>

<em>ii. Followed by a pair of curly braces representing the block for the method.</em>

<em>public int findMax(int num1, int num2){</em>

<em>     </em>

<em>}</em>

<em />

<em>iii. Within the block, write the statements to find out which is greater between num1 and num2</em>

This is done with an if..else statement. To check if num1 is greater than num2, write the following within the block.

<em>if(num1 > num2){</em>

<em>    return num1;</em>

<em>}</em>

<em>else {</em>

<em>  return num2;</em>

<em>}</em>

<em />

The if block tests if num1 is greater than num2. If it is, then num1 will be returned.

The else block is executed only if num1 is not greater than num2. In this case, num2 will be returned since it is greater.

<em>iv. Put all together</em>

<em>public int findMax(int num1, int num2){</em>

<em>    if(num1 > num2){</em>

<em>        return num1;</em>

<em>    }</em>

<em>   else {</em>

<em>       return num2;</em>

<em>    }</em>

<em>}</em>

<em />

<em />

<em />

You might be interested in
Who invented autonomous cars? When I look it up it comes up as William Bertelsen but he invented the idea of hovering cars. Help
Diano4ka-milaya [45]
The answer is Carnegie Mellon.
4 0
3 years ago
What is alphabet symmetry
Nataly [62]
A line of symmetry creates two congruent figures that are mirror images of each other
3 0
3 years ago
Read 2 more answers
The statistical report is typically used to set targets for the organization's expenditures for the year and then report actual
Snowcat [4.5K]

Answer:

False

Explanation:

Budget and Financial reports are used to set targets for organization's expenditure. These reports display cost and expenditures related to all assets, raw material, inventory of the organization. The variance is then calculated based on targeted figures and the actual expenses. The deviation from target is found by the variance and then actions are taken for it. Managers rely heavily on these reports. Statistical reports are non financial reports. These focus on customer satisfaction, employee performance, staff turnover rate and assets performance.

5 0
3 years ago
Scenario: The deputy incident commander will be replacing the current incident commander, who needs to attend to a family emerge
Flauer [41]

The current incident commander should: provide a transfer of command briefing to the new commander.

<h3>What is incident management?</h3>

Incident management can be defined as a strategic process through which a business organization (company) identifies, analyzes, and correct hazards and potential threats (problems), so as to ensure that normal service operation is restored as quickly as possible to its end users after a disruption, as well as to prevent a re-occurrence of these hazards in the future.

<h3>What is a command?</h3>

A command can be defined as a set of instruction which sets and provide the incident strategies, priorities, objectives, as well as possessing the overall responsibility for any incident.

In this scenario, we can infer and logically deduce that the current incident commander should provide a transfer of command briefing to the new commander because rank, grade, and seniority aren’t factors that are used to select an incident commander.

Read more on incident management here: brainly.com/question/11595883

#SPJ4

5 0
2 years ago
Write the definition of a function powerTo which recieves two parameters, a double and an integer. If the second parameter is po
FrozenT [24]

Answer:

Following is the definition of the required function:

def powerTo( double first, int second);

if second > 0;

double result = pow(first,second);

return result;

else

return 0;

Explanation:

The explanation for above code is as follows:

  • A function named powerTo is defined, having two arguments with data type double and integer respectively.
  • A if condition is applied that checks the second parameter.
  • If the the condition: second > 0 gets true, a value is returned which is equal to first parameter raised to the second.
  • If the condition is if bracket gets false, 0 is returned as a result.

i hope it will help you!

5 0
4 years ago
Other questions:
  • If you only use part of a quotation, it is not necessary to include a citation
    6·1 answer
  • HELP ASAP!! Ohms law homework
    11·1 answer
  • Why is it critical to provide proper treatment for minor and moderate sports injuries within the first 48 hours after sustaining
    14·1 answer
  • The sheets that supply the data in a summary sheet are called the
    10·1 answer
  • Code a Boolean expression that tests if a decimal variable named currentSales is greater than or equal to 1000 or a Boolean vari
    11·1 answer
  • To activate a wizard to help in creating combo boxes and command buttons, make sure the ____ button is selected
    6·1 answer
  • In Windows, the only was to start/stop MySQL Server is from the Command Prompt.
    7·1 answer
  • Fill in the boxes to show two ways you can find 8+6​
    8·1 answer
  • Because of increasing advances in technology, there are careers available that weren’t even invented 10 years ago. One such care
    13·1 answer
  • Accept total number of participants (B) in class. A group of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!