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]
2 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]2 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
True or false? a router is a network device that directs packets over a network towards their final destination.
Alex_Xolod [135]

A router is a web device that directs packages over a web towards their final destination is true.

<h3>What is the router?</h3>
  • A router is a machine that combines two or more packet-switched grids or subnetworks.
  • A router accepts and data transmits  on computer networks. Routers are sometimes confused with network hubs, modems, or network controllers.
  • However, routers can integrate the functions of these components, and secure with these devices, to improve Internet entry or help create interaction networks.
  • A router is a device that is used for forwarding the internet connection to all the related devices.
  • A Wi-Fi connects the networking parts of a router and a wireless access point.
  • A wireless router (or Wi-Fi router) works much like a wired router, but it returns wires with wireless radio calls.

To learn more about router, refer to:

brainly.com/question/24812743

#SPJ4

7 0
1 year ago
What is the definition of Graphic AIDS?.
V125BC [204]

Any image that helps you, the reader, understand the text that the visual aid is accompanied with is referred to as a visual graphic or graphic aid.

Too frequently, readers lazily scan or entirely ignore graphs, diagrams, charts, and tables. Grid graphs, tables, bar charts, flow charts, maps, pie diagrams, and drawings and sketches are the most popular. Relationships are displayed using grid graphs. A visual aid should always be used in conjunction with preparation to interest the audience, improve their comprehension of your message, elicit an emotional response, and assist you in communicating it effectively. Charts, diagrams, graphs, maps, flashcards, posters, images, photos, booklets, folders, pamphlets, cartoons, and comics are examples of graphic aids.

Learn more about graphic here-

brainly.com/question/1169945

#SPJ4

5 0
1 year ago
1. The opportunity to create several equations for launching program files is called
vladimir1956 [14]

\huge\underline\color{brown}\boxed{☕ANSWER:☕}

_________________________________

1. The opportunity to create several equations for launching program files is called

a) creating a file

b) creating a folder

✒ <u>c) creating a directory</u>

d) creating a shortcut

2. Unless you specify otherwise most spreadsheet packages assume all cell addresses are

a) macros

b) relative cell reference

c) absolute cell reference

✒<u> d) mix cell references</u>

3. Which of the following is not a type of lcon

a) program icon

✒ <u>b) document icon </u>

c) folder icon

d) utility icon

_________________________________

\normalsize\underline\color{yellow}\boxed{TheQuestionner}

\large\mathbb\color{orange}{Correct \: me \: if \: im \: wrong}

7 0
2 years ago
the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
marta [7]
A. the modem provides the wifi or internet to the computer
6 0
3 years ago
Read 2 more answers
"Why learning how to type is so important.
djverab [1.8K]
The productivity of a business depends on how things are done faster. To complete your work faster it is important to develop typing skills. Typing helps you to work comfortably on the computer, it aids in communicating with colleagues and customers, creating documents, and finding new information.
Hopefully this helped.
8 0
3 years ago
Other questions:
  • Write a sequence of statements that create a file named "greeting" and write a single line consisting of "Hello, World!" to that
    5·1 answer
  • Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then con
    10·1 answer
  • With a(n) ____ structure, you perform an action or task, and then you perform the next action in order.
    6·1 answer
  • What is a spreadsheet program?<br> A spreadsheet program is a computerized version of_________.
    6·2 answers
  • Briefly explain what is net neutrality and why is it important today
    15·1 answer
  • Which of the following is the fastest way to open an Access database? a. Right-click the database icon. b. Start Access from the
    13·2 answers
  • What are Important points to include about preventing the download of malware?
    14·1 answer
  • James root lol ........................
    12·1 answer
  • Describe your ideas for a keyboarding game that would help someone improve their skills.
    6·1 answer
  • What does the asterisk (*) after select tell the database to do in this query?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!