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
What is the definition of overflow in binary?
asambeis [7]
Overflow occurs when the magnitude of a number exceeds the range allowed by the size of the bit field. The sum of two identically-signed numbers may very well exceed the range of the bit field of those two numbers, and so in this case overflow is a possibility.
4 0
3 years ago
Your organization has started receiving phishing emails. You suspect that an attacker is attempting to find an employee workstat
EastWind [94]

Answer:

E). User education and training.

Explanation:

In the context of network security, the most significant aspect of ensuring security from workstation cyberattacks would be 'education, as well as, training of the users.' <u>If the employee users are educated well regarding the probable threats and attacks along with the necessary safety measures to be adopted and trained adequately to use the system appropriately so that the sensitive information cannot be leaked</u> while working on the workstation and no networks could be compromised. Thus, <u>option E</u> is the correct answer.

3 0
2 years ago
Write a program that allows the user to enter a start time and a future time. Include a function named compute Difference that t
Aleonysh [2.5K]

Step 1

Following is the c++ program:

Variables used:

startHours, startMins are used to store the starting time of time machine.

futureHours, futureMins are used to store the future time of time machine.

xAM variable is used to store meridiem of start and future time.

isSAM is boolean variable that is true if starting time is AM.

isFAM is boolean variable that is true if future time is AM.

 

Functions:

main() is used to call computeDifference() function that will calculate the difference between the start and future time.

computeDifference() takes as input six variables from the user and then apply the following logic to compute the difference between the start and future time:

If Meridien of both start and future time are the same, then simply subtract the start time from the future time.

Difference = future minutes – start minutes

If Meridien of both start and future time are different, then apply the following formula to calculate difference:

Difference = (12 * 60 – start minutes) + future minutes

Step 2

Program :

#include <iostream> //header file for input and output

 

using namespace std;

//calculate the time difference(in minutes) between start time and future time.

int computeDifference(int startHours, int startMins, bool isSAM, int futureHours, int futureMins, bool isFAM) {

 int difference = 0; //to store difference

 startMins = startHours * 60 + startMins; //converting in minutes.

 futureMins = futureHours * 60 + futureMins; //converting in minutes.

 //applying formula for difference.

 if (isSAM == isFAM) {

   difference = futureMins - startMins;

 } else if (isSAM == true && isFAM == false) {

   difference = (12 * 60 - startMins) + futureMins;

 }

}

int main() {

 int startHours, startMins; //it will store start time

 int futureHours, futureMins; //it will store future time.

 string xAM; //it will store meridiem.

 bool isSAM; //it will be true if start time is AM.

 bool isFAM; //it will be true if future time is in AM.

 int difference = 0; //it will store difference.

 cout << "Enter start time of time machine as 'HH MM AM/PM': "; //take input from

7 0
3 years ago
can somebody tell me what straykids 2021 collab is gonna be with because i think its gonna be with blackpink
valkas [14]

Answer:

Red velvet: Red Velvet made its debut in 2014, so it is highly probable that SM Entertainment might announce whether or not members of the group will continue to stay in the company by the end of 2021.

Explanation:

Probably black and white, or gold and white Or Gucci clothes.

7 0
2 years ago
Read 2 more answers
Three broad categories of cryptographic algorithms are commonly used to create PRNGs: symmetric block ciphers, asymmetric cipher
RideAnS [48]

Answer:

True.

Explanation:

In generating PRNGs, several specific types of crypto algorithms will be widely will use: linear cipher block, nonlinear ciphers, as well as hash methods and authorization instructions in messages. So, that's why the following scenario is true about the cryptographic algorithms because this is a collection of several excellently defined however complicated mathematics techniques for encoding or decoding information.

7 0
3 years ago
Other questions:
  • Explaim Why the shape of a cell is hexagonal
    15·1 answer
  • Write a program that displays the following pattern: ..\.\* .\.\*** \.\***** ******* \.\***** .\.\*** ..\.\* That is, seven line
    8·1 answer
  • Which of the following is an encryption tool that allows users to encrypt files and folders by simply right-clicking a given obj
    10·2 answers
  • How does modularity provide flexibility in a structured programming design?
    6·1 answer
  • Write an application that instantiates five Recording objects and prompts the user for values for the data fields. Then prompt t
    13·1 answer
  • Which of the following things could you do in order to tell if a pair of colors has strong contrast? A. Look at the colors on th
    12·1 answer
  • hãy lựa chọn một doanh nghiệp kinh doanh theo loại hình siêu thị việt nam em hãy tìm hiểu doanh nghiệp và thực hiện theo yêu cầu
    10·1 answer
  • You are setting up a small network. The customer has decided to change his internet service provider (ISP) to EtherSpeed. The IS
    9·1 answer
  • A(n) ___ is a set of CPUs which work in parallel in an attempt to simulate the way the human brain works, although in greatly si
    5·1 answer
  • Free point giveaway pt.10 and brainliest to first answer
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!