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
Need to know? Anyone feel like helping me not fail
8_murik_8 [283]
I’m not sure but i think it might be design
4 0
2 years ago
How important "saving" in every individual?​
photoshop1234 [79]

Answer:

The importance of saving money is simple: It allows you to enjoy greater security in your life. If you have cash set aside for emergencies, you have a fallback should something unexpected happen. And, if you have savings set aside for discretionary expenses, you may be able to take risks or try new things.

4 0
2 years ago
A cell's address, its position in the workbook, is referred to as a ________________ when it is used in a formula.
Inga [223]

Answer:

A cell's address, its position in the workbook, is referred to as a <u>cell reference</u>  when it is used in a formula.

5 0
2 years ago
Which three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI
Sholpan [36]

Answer:

Primary DNS server

Secondary DNS server

Default gateway

Explanation:

The following tests are performed by ESXi:

  • Pings the subnet gateway that is stated.
  • Pings the primary DNS server that is stated.
  • Pings the secondary DNS server that is stated.
  • Ensure that the hostname of the ESXi host is resolved by it.

Based on the above, the three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI are are therefore the following:

  • Primary DNS server
  • Secondary DNS server
  • Default gateway
5 0
2 years ago
Northern Trail Outfitters (NTO) has over 20,000 Accounts and 75,000 Contacts. NTO wants to ensure the customer data is accurate
tatuchka [14]

Answer:

NTO can use a data enrichment tool, this with the purpose of verifying that the account and contact information is up-to-date.

Explanation:

In the current market some examples of data enrichment tools are:

  • LeadGenius
  • DiscoverOrg
  • Leadspace
  • Openprise
6 0
2 years ago
Other questions:
  • In the database below, the arrow is pointing to a _____.<br> file<br> record<br> field<br> key field
    12·1 answer
  • A(n) _____ is a fake online persona created to promote a particular point of view, often in praise of a firm, product, or indivi
    15·1 answer
  • Who does Potholes effect in South Africa?
    15·1 answer
  • Write an if else statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. O
    5·1 answer
  • A packet analyzer is a program that can enable a hacker to do all of the following EXCEPT ________. Select one: A. assume your i
    6·1 answer
  • Andy wants to install a new Internet connection. He wants to take the fastest he can get. What are the maximum speeds for the fo
    9·1 answer
  • Rafael needs to add a title row to a table that he has inserted in Word. What should he do? Use the alignment options. Use the M
    14·2 answers
  • List any three importance of computer points​
    8·1 answer
  • You wrote a program to find the factorial of a number. In mathematics, the factorial operation is used for positive integers and
    14·2 answers
  • Identify the three fuzzy logic systems in the given text.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!