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]
3 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]3 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
How would a programming language that allows programs to run on any operating system be classified?
Illusion [34]
Cross-platform.





--------------------
3 0
3 years ago
Why doesn't the ad load ?
baherus [9]
Try refreshing the page, if not restart your device check your internet etc.
3 0
2 years ago
Read 2 more answers
What shows on the web, what is behind the web (source code) and what is placed on the server (database) , is known as web source
slega [8]

Answer:

A. True

Explanation:

Websites are created using html, css, javascript and other web based programming languages. When a website page is requested, the host server sends the copy of the source code to the web browser of the client system, the web browser is able to interpret the source code and displays the graphical representation on the web browser for the client.

3 0
3 years ago
Stay at least _____ behind the vehicle ahead of you at all times.
fenix001 [56]

Answer:

B 4 seconds

Explanation:

You should stay 4 seconds away from a vehicle at all times at the same speed as the other vehicle or vehicles.

6 0
2 years ago
Read 2 more answers
Create a program that prints out a list of all the divisors of a number stored in a variable. (If you don’t know what a divisor
UkoKoshka [18]

Answer:

// Program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main()

{

// Declare integer variable n which serves as the quotient.

int n;

// Prompt to enter any number

cout<<"Enter any integer number: ";

cin>>n;

// Check for divisors using the iteration below

for(int I = 1; I<= n; I++)

{

// Check if current digit is a valid divisor

if(n%I == 0)

{

// Print all divisors

cout<<I<<" ";

}

}

return 0;

}

7 0
3 years ago
Other questions:
  • Because you do not know every possible future use for the data TerramEarth collects, you have decided to build a system that cap
    15·1 answer
  • A network administrator notices that some newly installed Ethernet cabling is carrying corrupt and distorted data signals. The n
    8·1 answer
  • In order to plan George's birthday, his father gave him a list of people who attended his birthday for the last five years. What
    5·1 answer
  • Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all th
    11·1 answer
  • A home user reports to a network technician that the Internet is slow. The network administrator discovers that multiple unknown
    12·2 answers
  • Two Technicians are discussing ShopKey Pro. Technician
    14·1 answer
  • suppose as a head software engineer you assign the job of creating a class to a subordinate. You want to specify thirty-eight di
    11·1 answer
  • Which format of image files can be inserted in html?​
    8·2 answers
  • In one to two sentences, describe how you would add a new slide to your presentation.
    11·2 answers
  • Need answer ASAP!!!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!