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
Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids.Sample output for the g
topjm [15]

Answer:

class PersonInfo:

   def __init__(self):

       self.num_kids = 0

   def inc_num_kids(self):

       self.num_kids += 1

person1 = PersonInfo()

print('Kids:', person1.num_kids)

person1.inc_num_kids()

print('New baby, kids now:', person1.num_kids)

Explanation:

Line 1 of the code, we define the class PersonInfo. Line 3 of the code is the function that will increment the member data num_kids.

4 0
3 years ago
Which statement best describes network security
Andreyy89
<span>B.network security means all personal information is kept safe the network is not compromised and only authorized users had access 

Im pretty sure they ment has instead of had</span><span />
3 0
2 years ago
Read 2 more answers
Apart from confidential information, what other information does NDA help to outline ?
Vikki [24]

There isn't enough info for me to answer this with complete confidence XD.

6 0
3 years ago
The value 5 is stored in a signed (2's complement) integer. The bits are shifted 4 places to the right. What is the resultant va
anastassius [24]

Answer:

The resultant value is 0

Explanation:

Solution

Given that:

Now

The +5 representation in signed 2's complement integer: 00000101

Thus

When we right shift then, 4 rightmost bit (0101) will be dropped.

The number after 4-bit right shift: 00000000

Therefore the resultant value after 4-bit right shift is "0" in decimal.

6 0
2 years ago
A grid that organizes data is a
sukhopar [10]
Spreadsheet i believe
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following option is correct about HCatalog?
    14·1 answer
  • Where should you look for most objective and unbaised information
    15·1 answer
  • You put $500 in an interest bearing bank account that pays 2% per year but has a fee of $2 per month. Are you getting ahead?
    14·2 answers
  • A block style business letter is
    14·1 answer
  • Where would the information needed to start a computer be stored
    10·1 answer
  • While using the CLI on a Windows 10 64-bit computer with a single HDD and a single volume, you want to move from the current dir
    15·1 answer
  • Which file extension takes less storage space?
    13·2 answers
  • Suppose you are given a text file. Design a Python3 program to encrypt/decrypt that text file as follows:
    14·1 answer
  • which of the following devices and and receive information from other device? a parallel port B serial port C video port d both
    8·1 answer
  • **HELP ME PLS**
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!