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
diamong [38]
2 years ago
10

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.
Computers and Technology
1 answer:
antoniya [11.8K]2 years ago
7 0

Answer:

   public static int maxMagnitude(int a, int b){

       int max;

       if (a>b){

           max = a;

       }

       else{

           max = b;

       }

       return max;

   }

The complete program calling the method is given in the explanation section

Explanation:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

     Scanner in = new Scanner(System.in);

       System.out.println("Please Enter two numbers");

       int num1= in.nextInt();

       int num2 = in.nextInt();

       System.out.println("The largest magnitude number is: "+maxMagnitude(num1,num2));

   }

   public static int maxMagnitude(int a, int b){

       int max;

       if (a>b){

           max = a;

       }

       else{

           max = b;

       }

       return max;

   }

}

The maxMagnitude() method uses if/else statement to compare two ints and return the larger one

You might be interested in
The Ntds. dit file is a database that stores Active Directory data, including information about user objects, groups, and group
vladimir2022 [97]

Answer:

I hate it

Explanation:

Mark it as the brainliest if u love god

8 0
2 years ago
Outside of a C program, a file is identified by its ________while inside a C program, a file is identified by a(n) ________. fil
Alexxandr [17]

Answer: name, file stream object

Explanation:

4 0
2 years ago
Which font is most suitable for an academic article on a website? Which is most suitable for casual information?
CaHeK987 [17]

There are thousands of fonts, there is no clear answer of what is best for ___ website or ___ page. It's all what you think looks good and sometimes depends on the colors on the site.

4 0
3 years ago
Read 2 more answers
Which of the following is an example of a logic error?
rusak2 [61]

Answer:

Receiving unexpected results from a program

Explanation:

Logic errors are due to the program not producing a desired result.

6 0
3 years ago
Read 2 more answers
i need a moderator or someone to answer this :/ why do i keep getting notifications that i have a new chat or a new answer/comme
Lyrx [107]

Answer:

It happens to me as well. Maybe check emails?  It could also be a bug.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Need Help !!! Please
    8·1 answer
  • What does it mean to say that two variables are negatively correlated?
    6·1 answer
  • Create a class, using separate files, named DynamicGrades. (2 points) This class has three data members: an int that represents
    13·1 answer
  • Decision making at the executive or strategic level requires business intelligence and knowledge to support the uncertainty and
    12·1 answer
  • When you open as many links as you want, and still stay in the same browser window instead of cluttering your screen with multip
    5·1 answer
  • What are finger nails made of?-
    12·2 answers
  • The MAC address is a _____ bit number.
    10·2 answers
  • What is the diffrent between ibm pc and ibm compatibles in table:​
    11·1 answer
  • What does the following loop do? val = 0 total = 0 while (val < 10): val = val + 1 total = total + val print(total)
    15·1 answer
  • Have some points part 6<br>anyone know how to change my username?​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!