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
A new object of type list is created for each recursive invocation of f.A. TrueB. False
sammy [17]

Answer:

True but double check!

7 0
3 years ago
When creating a user generated function, what procedure is followed?
marin [14]

When creating a user-generated function, what procedure is followed d) all of the above.

<h3>What are the three factors of user-described characteristic?</h3>

A user-described characteristic has 3 essential additives which might be characteristic declarations, characteristic definition and characteristic called.

The characteristic prototypes are used to inform the compiler approximately the variety of arguments and approximately the specified datatypes of a characteristic parameter, it additionally tells approximately the go-back kind of the characteristic. By this information, the compiler cross-assessments the characteristic signatures earlier than calling.

Read more about the prototype :

brainly.com/question/7509258

#SPJ1

6 0
2 years ago
Henry is working from a USDA office. He has several tasks to perform today: 1) he logs onto his USDA computer to get started; 2)
Ksivusya [100]

Answer:

  A. Using a cell phone to discuss sensitive information

Explanation:

In general, cell phone signals are not secure. Cell phones without appropriate encryption should never be used to discuss sensitive information.

3 0
3 years ago
Think about the ways new communication technologies can make certain tasks easier for
Andru [333]
Technology gives them the ability to do things that they normally couldn’t do. Like deaf people could get a cochlear implant to make them hear, people without a leg can get a prothetic leg to help them walk. Even something as simple of being colorblind, there are glasses to help them see color. It’s amazing.
3 0
3 years ago
In ____________________ testing, security personnel simulate or perform specific and controlled attacks to compromise or disrupt
babunello [35]

Answer:

penetration.

Explanation:

In penetration testing, security personnel simulate or perform specific and controlled attacks to compromise or disrupt their own systems by exploiting documented vulnerabilities.

4 0
3 years ago
Other questions:
  • Write a program named TypingGrades that allows a user to enter a student’s number of words typed. The output is the letter grade
    9·1 answer
  • Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a
    13·2 answers
  • If it malfunctions and I can throw it, then it's a hardware problem; if I have to yell at it because there is nothing to pick up
    14·2 answers
  • When you schedule an appointment, Outlook adds the appointment to the ____ folder by default.
    10·1 answer
  • Twitter, Foursquare, and other real-time media add to or leverage capabilities of smartphones--improving your ability to be well
    9·1 answer
  • Which file extension indicates a Microsoft Excel document?
    7·1 answer
  • How do graphic designers showcase their work?
    14·2 answers
  • True or False?Only flying unmanned aircraft over 20lbs requires preparation and safety calculations.
    8·1 answer
  • Which of the following behaviors does not harm a company if your employment is terminated?
    9·1 answer
  • How do i make a comment on brainly?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!