Question

Write a program that inputs from the user an angle (measured in degrees) then computes and...

Write a program that inputs from the user an angle (measured in degrees) then computes and prints: (the trigonometric sine of the angle in radians) squared + (the trigonometric cosine of the angle in radians) squared. Test your program on different degrees; if your program is working correctly, the result should be 1 each time (pythagorean trigonometric identity).

IN JAVA THANK YOU

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//PythagoreanTrigonometricIdentity.java
import java.util.Scanner;
public class PythagoreanTrigonometricIdentity {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter an angle (measured in degrees): ");
        double angle = scan.nextDouble();

        System.out.println(Math.pow(Math.sin(angle),2)+Math.pow(Math.cos(angle),2));
    }
}

Add a comment
Know the answer?
Add Answer to:
Write a program that inputs from the user an angle (measured in degrees) then computes and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2) Write a C++ program that uses a class called “Degree” to obtain the trigonometric values...

    2) Write a C++ program that uses a class called “Degree” to obtain the trigonometric values for angles given in degrees. This is because the trigonometric functions defined in the library file <cmath> are applied to radian angles only. Use the constant DEG2RAD = 0.017453 for conversion from degrees to radians. This class must include a constructor, destructor, and the following functions: a. void set_value(double) b. double get_value() c. double get_sine() d. double get_cosine() e. double get_tangent() f. void read_value()...

  • 1.Write a Java program that computes the average of the values of a row in a...

    1.Write a Java program that computes the average of the values of a row in a twodimensional array. You should create a method with the following header: public static double averageRow(double[][] array, int row) Write a test program that reads a matrix from the user and a row index to calculate the average on. Print the result. 2.A square matrix is said to be an upper triangular matrix if the value of the cell is 0 when row > column....

  • In Java, write an application that inputs one number consisting of five digits from the user,...

    In Java, write an application that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print 4 2 3 3 9 Using GUI input and message dialog Thank you

  • Write MARIE assembly language programs that do the following: I. Write a program that inputs thre...

    Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...

  • **This is for the C Language. Trigonometric Calculator Specification You are required to write a program...

    **This is for the C Language. Trigonometric Calculator Specification You are required to write a program that calculates and displays values of the trigonometric functions sine, cosine, and tangent for user-supplied angular values. The basic program must comply with the following specification. 1. When the program is run, it is to display a short welcome message. TRIG: the trigonometric calculator 2. The program shall display a message prompting the user to enter input from the keyboard. Please input request (h-help,...

  • Write a program that reads a sequence of integers into an array and that computes the...

    Write a program that reads a sequence of integers into an array and that computes the alternating sum of all elements in the array. For example, if the program is executed with the input data: 2 1 4 9 16 9 7 4 9 11 Then it computes 2 - 1 + 4 - 9 + 16 - 9 + 7 - 4 + 9 – 11 = 4 Use a scanner object to gather the inputs from the user....

  • Write a program that inputs a string of comma separated test scores from the user and...

    Write a program that inputs a string of comma separated test scores from the user and prints out a histogram of the scores. The histogram should have one row on it for each distinct test score, followed by one star for each test score of that value. For example, if the tests scores in the file were 55, 80, 80, 95, 95, 95 and 98, the output to the screen should look like: 55 * 80 ** 95 *** 98...

  • write a java program that prompts a user to enter two different numbers, divide the first...

    write a java program that prompts a user to enter two different numbers, divide the first number by second and prints the result

  • Write a program which: - prompts the user for 2 numerical inputs - stores their two...

    Write a program which: - prompts the user for 2 numerical inputs - stores their two inputs in variables as floats - Use a while in loop to ask a user for a valid operation: (if the user's input operation isn't one of those listed above, instead print a message telling them so, and continue asking for the valid operation) - prompts the user for an arithmetic operation ( + - * / %) - stores the user's input as...

  • USING PYTHON *Write a program, in which the user enters two numbers, then divides the first...

    USING PYTHON *Write a program, in which the user enters two numbers, then divides the first number by the second, and prints the result to two decimal places. *Make sure that that the inputs are floats (with exception handling using the ValueError). *Make sure that there is no divide by zero error (with exception handling). *Then have a plain exception: That handles any other error. -Thank you in advance for your assistance-

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT