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
grigory [225]
2 years ago
13

Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a pr

ogram that takes two integer inputs, and outputs the largest magnitude value.
Ex: If the inputs are: 5 7 the method returns: 7
Ex: If the inputs are: -8 -2 the method returns: -8
Computers and Technology
1 answer:
yawa3891 [41]2 years ago
3 0

Answer:

The program in Java is as follows:

import java.util.*;

import java.lang.Math;

public class Main{

public static int maxMagnitude(int num1, int num2){

    int mag = num2;

    if(Math.abs(num1) > Math.abs(num2)){

        mag = num1;

    }

    return mag;

}

public static void main(String[] args) {

 int num1, num2;

 Scanner input = new Scanner(System.in);

 System.out.print("Enter two integers: ");

 num1 = input.nextInt();

 num2 = input.nextInt();

 System.out.println(maxMagnitude(num1,num2));

}

}

Explanation:

The method begins here

public static int maxMagnitude(int num1, int num2){

This initializes the highest magnitude to num2

    int mag = num2;

If the magnitude of num1 is greater than that of num2

    if(Math.abs(num1) > Math.abs(num2)){

mag is set to num1

        mag = num1;

    }

This returns mag

    return mag;

}

The main  method begins here

public static void main(String[] args) {

This declares num1 and num2 as integer

 int num1, num2;

 Scanner input = new Scanner(System.in);

This prompts the user for two integers

 System.out.print("Enter two integers: ");

This gets input for the first integer

 num1 = input.nextInt();

This gets input for the second integer

 num2 = input.nextInt();

This calls the maxMagnitude method and prints the number with the highest magnitude

 System.out.println(maxMagnitude(num1,num2));

}

You might be interested in
In the food Chiain above the spiders are
Leno4ka [110]

Many types of birds and wasps

6 0
3 years ago
FIRST AMSWER GET BRAINLIEST​
MA_775_DIABLO [31]

Answer:

agile --> business modeling

RAD --> pair programing

waterfall --> deployment

spiral --> risk analysis

v-shaped model --> integration testing

not too sure about this but i tried

4 0
2 years ago
Google Ads Was Designed To Deliver Three Things To Every Advertiser: Relevance, Control, And Results. It Provides Relevance By C
ANTONII [103]

Answer:

4. By giving advertisers control over the maximum they spend per month.

Explanation:

Google ads provides relevant by giving advertisers control over the maximum they spend per month.

When one wants to set up a google ad, There are three things that are always the objectives, to have control, to producs Result and to have relevance.

By having relevance, google ads tend to give the advertisers control over maximum they spend per month. It helps them maintain the amount each campaign will cost them in any particular month.

The importance of relevance is that the advertisers dont have to spend if he dont want.

6 0
3 years ago
true or false The internet is a local communication network that allows only certain computers to connect and exchange informati
Montano1993 [528]

I think it would be False. Because its not only certain computers that can connect to the internet & send/receive messages, its any device that has access to it. Hope this helps! =^-^=

5 0
3 years ago
InJavaScript, a variable declaration is
OverLord2011 [107]

Answer:

Optional

Explanation:

Variable declaration means when you declaring a variable in the code,whenever you want to use a variable you should declare it or define the variable with come constant.

<u>Example</u>

var name ;

The variable has no value after the statement (technically it has undefined value). Declaring a variable without var keyword is not recommended. An current global variable may accidentally be overwritten.

<u>Example</u>

a=2;

The range of variables declared without var keywords becomes global regardless of where they are declared

8 0
3 years ago
Other questions:
  • Write a program that determines the price of a movie ticket (similar to the one in the chapter). The program asks for the custom
    9·1 answer
  • Ann wants to download Adobe Acrobat software from the Internet. Prior to downloading, a standardized online contract appears on
    7·1 answer
  • Create a class called Clock to represent a Clock. It should have three private instance variables: An int for the hours, an int
    15·1 answer
  • Which of the following type of software is the most powerful for managing complex sets of data?
    6·2 answers
  • Analyze the following code.
    10·1 answer
  • The process of capturing moving images on film or a digital storage device is called?
    6·1 answer
  • In the 2018-2019 softball season, Allison hit the ball 28 out of 67 times, this included fouls. What was her percentage
    14·1 answer
  • Different search engines available on the internet​
    7·1 answer
  • The two most popular forms of animation today are Disney animation and Japanese anime. Each style differs from the other in many
    7·1 answer
  • ((Excel)) please help, 100 points, and brain crown thingy, not only that, i will make several of these so you can get several hu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!