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
rusak2 [61]
4 years ago
10

Write a static method named anglePairs that accepts three angles (integers), measured in degrees, as parameters and returns whet

her or not there exists both complementary and supplementary angles amongst the three angles passed. Two angles are complementary if their sum is exactly 90 degrees; two angles are supplementary if their sum is exactly 180 degrees. Therefore, the method should return true if any two of the three angles add up to 90 degrees and also any two of the three angles add up to 180 degrees; otherwise the method should return false. You may assume that each angle passed is non-negative.
Computers and Technology
1 answer:
padilas [110]4 years ago
8 0

Answer:

The java program for the scenario is given below.  

import java.util.*;

public class Test

{

// method returning sum of all digits in the integer parameter

static boolean anglePairs(int a1, int a2, int a3)

{

   // variable to hold sum of two complementary angles

   int comp=90;  

   // variable to hold sum of two supplementary angles

   int supp=180;

   // boolean variable to hold result

   boolean result = false;

   if( (a1+a2 == comp) || (a2+a3 == comp) || (a1+a3 == comp) )

   {

       if( (a1+a2 == supp) || (a2+a3 == supp) || (a1+a3 == supp) )

           result = true;

       else

           result = false;

   }    

           // return variable result

       return result;

}

public static void main(String[] args)

{

   // method is called by passing three positive angles

   System.out.println("The pair of angles have both complementary and supplementary angles " + anglePairs(100, 80, 90) );    

}

}

OUTPUT

The pair of angles have both complementary and supplementary angles false

Explanation:

The program works as described below.

1. The method, anglePairs(), is declared as static having return type as Boolean which takes three positive integer parameters.

static boolean anglePairs(int a1, int a2, int a3)

{

}

2. The integer variable, comp, is declared and initialized to 90.

3. The integer variable, supp, is declared and initialized to 180.

4. The Boolean variable, result, is declared and initialized to false.

5. Using if-else statements, sum of two angles are compared with the variables, comp and supp.

6. If the sum of any two angles match with both, comp and supp, variables, the Boolean variable, result is assigned value true. Otherwise, result is assigned value false.

7. The value of result is returned.

8. Inside main() method, the function anglePairs() is called and three positive numerical values are passed as parameters.  The output is displayed.

9. All the above code is written inside the class Test.

10. User input is not taken since it is not mentioned in the question.

You might be interested in
I need someone to help. This is the links I found and I'm going through the same thing. I live in small town where they think I'
Hunter-Best [27]

Huh what exactly do you need help with

8 0
3 years ago
Mobile legends new hero in october aamon is coming in october 26th
defon

Answer:

yellow

Explanation:

3 0
3 years ago
Read 2 more answers
Here's one just for fun . For all the car people on here !
Doss [256]

its B...... Dodge challenger SRT Demon


8 0
3 years ago
Read 2 more answers
How many microprocessors will a small computer have
Arte-miy333 [17]
Well, most of the new Pc's today have dual-core central processors (CPU). They only have one chip with two complete microprocessors on it, both of them share one path to memory and peripherals. But if it's a high-end hardcore gaming Pc, you could have two processor chips with 4 microprocessors on each.
4 0
4 years ago
Read 2 more answers
Shreya has combined all the cells in a single leftmost column in a table. Instead of identifying the category multiple times, sh
lubasha [3.4K]

Answer:

what is the answer

Explanation:

3 0
4 years ago
Other questions:
  • He ____ is the section of a cpu core that performs arithmetic involving integers and logical operations.
    14·1 answer
  • What does microsoft recommend for large organizations requiring desktop virtualization for many clients? quizlewt?
    10·1 answer
  • Sidney works in the accounting department. His boss just assigned him a task that involves creating budget formulas for the comp
    15·1 answer
  • Which biometric technique is considered nearly infallible from a scientific point of view and is increasingly preferred by crimi
    8·1 answer
  • Touchdowns were worth 7 points. Braydenand Gavin scored 7 touchdowns. Cole andFreddy's team scored 9 touchdowns. Howmany more PO
    5·1 answer
  • A strategic business unit​ (SBU) of a major corporation has high market share in its​ industry, but the growth rate of the indus
    8·2 answers
  • Who was the founder of the location-sharing site Whrrl
    6·1 answer
  • When you check the spelling in a document, one of the options is to add unrecognized words to the dictionary. If you were workin
    8·1 answer
  • To see the formula in a cell, look at the___
    5·1 answer
  • I cant tell if tubbo is a bee or a goat <br>or could he be human in the smp
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!