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
We need goku and naruto fight story someone
lana [24]

Answer:

goku comes in and turns super sayain  naruto come in with kurama and naruto get goku with a rasagen and geku is still fist fightin while naruto is using his kurama and turns into kurama and knocks out goku now naruto thinks he won and goku IS HITIN HIM WITH A KAMEKAMEHA GOKU IS SIROUS NOW

Explanation:

8 0
2 years ago
Read 2 more answers
____________________ memory is the ability to add RAM without shutting down the computer or operating system.
Liula [17]

Answer:

Hot-add

Explanation:

The computer system is a electronic device that is used to perform computational task on input data for a pre-dertermined result. The components of the computer is divided into hardware and software components.

The hardware components are the physical parts of the computer system, while the software component are the instructions that runs the system.

The RAM is a physical component that provides memory for running current activities on the monitor screen. When it is removed or faulty, the screen goes blank. To add more RAM memory to the system while the system is on, activate the hot-add memory settings.

4 0
2 years ago
A business has recently deployed laptops to all sales employees. The laptops will be used primarily from home offices and while
lys-0071 [83]

C. OS hardening.

Making an operating system more secure. It often requires numerous actions such as configuring system and network components properly, deleting unused files and applying the latest patches.

The purpose of system hardening is to eliminate as many security risks as possible. This is typically done by removing all non-essential software programs and utilities from the computer.

5 0
2 years ago
Motorcycles have two or three wheels, a seat for the rider and at least a ____ horse-powered engine.
Gnoma [55]
Motorcycles have two or three wheels, a seat for the rider and at lease a 70 horse-powered engine. 
4 0
3 years ago
Read 2 more answers
What are some particular game ideas for a Roblox developer. *Ideas that weren't copied or done before (simulators, tycoons, you
Helga [31]

Hi! I've also been playing Roblox since 2009, and I know the struggle of wanting to create an "original" game that hasn't been made before on Roblox.

As a member of RAT and a fan of Polymorphic's games in that group, I just wanna say that the games you were a part of (and others, I'm sure) are amazing.

As for original games, that's unfortunately pretty difficult because Roblox Studio and the Roblox platform has some limitations as to what games you can create. However, I can still offer some ideas that I've always wanted to make, but couldn't because of my lack of scripting/building ability.

I used to be a huge fan of Pokemon, and games like Pokemon Arena X on Roblox. I've always wanted to make a game based off Pokemon, except instead of being limited to using 6 Pokemon at a time, I'd want to be able to build an army. For example, I want to be able to fight other trainers by commanding and summoning my various groups of Pokemon while flying on my Dragonite. Or having a separate cutscene when you encounter another trainer that looks something like Warlords 2: Rise of Demons (search this up on Google and you'll be able to see the format I'm talking about for a fight scene). If not a Pokemon conquest, maybe just another Pokemon minigame; those were always popular but ended up being deleted for reasons I'm not 100% sure of.

I've also always loved action games. What about making a game where you kill other Robloxians, but in order to do so, you have to possess NPCs within the game? You're a spirit with no power except the a starterpack of a few weapons and the ability to take over NPC bodies or characters, ranging from a snail that is extremely slow to someone who owns a gun or tank or whatever. I've never really thought about the details, but you can only possess a character for a certain amount of time before they realize they're being possessed and expel you. Then to switch "bodies", you have to spin a wheel or something and you can integrate game passes to improve probability.

These are just some ideas that you definitely don't even need to consider, and may not even be possible to integrate on Roblox's platform. But feel free to respond with your feedback or even add me on Roblox if you want to collaborate more. Just respond with your wishes and I'll get back to you when I come onto Brainly again.

Hope I was able to help :)

4 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) ________ is a variable that receives an argument that is passed into a function. global argument scope parameter
    15·1 answer
  • In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries.
    8·1 answer
  • What is the difference between delete and backspace key?​
    12·2 answers
  • I'm 11, except my profile says I'm 15.
    15·1 answer
  • AP CSP - Write a program that takes 10 random numbers from 1 to 12 inclusively and averages them together.
    8·1 answer
  • ¿Qué diferencia existe entre un virus biológico y virus informático?
    12·1 answer
  • Which of the following are downlink transport channels?
    12·1 answer
  • PLEASE HURRY!!<br> Look at the image below!
    11·2 answers
  • Which principle or element of layout design is highlighted in this event poster?
    7·1 answer
  • Visual Basic: What are arrays, please give an example code.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!