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]
3 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]3 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
Question is in photo
Alisiya [41]
Is this java or python pls explain or else i can’t answer
3 0
3 years ago
Macro photographs are what type of photographs? A. Close-up B. Telephoto C. Abstract D. All of the above
scZoUnD [109]

Answer:

A

Explanation:

they are close up. they are not telephoto or abstract

marco can be telephoto, but it is not nessacarily always telephoto. marco is by definition a close up photo

5 0
3 years ago
Dear Brainly, since you don't respond anyother way...
madreJ [45]

Answer:

that's an amen stop deleting our stuff deleters!.!!!!!

6 0
2 years ago
Read 2 more answers
Complete the method, isPerfectSquare(). The method takes in a positive integer, n. It returns a boolean that is true if n is a p
ratelena [41]

Answer:

  1. public class Square {
  2.    public static boolean isPerfectSquare(int n){
  3.        int sqrt_n = (int) Math.sqrt(n);
  4.        if(sqrt_n * sqrt_n == n ){
  5.            return true;
  6.        }else{
  7.            return false;
  8.        }
  9.    }
  10. }

Explanation:

Firstly, use sqrt method from Math package to calculate the square root of input n (Line 3). Cast the result to integer and assign it to sqrt_n variable.

Next, square the sqrt_n and check if it is equal to input n (Line 4). If so, return true, if not, return false (Line 4-8).

7 0
3 years ago
Memory: 5 bit addresses Cache: 8 blocks All memory locations contain valid data If the memory location is 15. What is the Binary
VMariaS [17]

Answer:

see explaination

Explanation:

If the cache contains 2k blocks, then the data at memory address i would go to cache block index ( i mod 2k )

Memory address = 5 bit

Cache block = 23

So, if the memory location is 9, then binary address = 01001 and cache block = 9 % 8 = 1 = 001

if the memory location is 12, then binary address = 01100 and cache block = 12 % 8 = 4 = 100

if the memory location is 15, then binary address = 01111 and cache block = 15 % 8 = 7 = 111

6 0
3 years ago
Other questions:
  • --- is a set of applications that manages the activities and resources of a computer.
    12·1 answer
  • Alcohol does not affect the driver judgement
    8·2 answers
  • What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
    10·1 answer
  • Multisensory input/output devices, such as data gloves or jumpsuits, are commonly used with _______________ systems.
    12·1 answer
  • Plz answer me will mark as brainliest​
    8·1 answer
  • Help with this pleaseeeeeee​
    7·1 answer
  • If you have 60fps on your laptop tell me one way you can go to 240fps
    14·2 answers
  • Which of the following restricts the ability for individuals to reveal information present in some part of the database?
    11·1 answer
  • Which of the following is the best description of an ip address?
    8·1 answer
  • Q) Look at the code and determine the output
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!