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
MaRussiya [10]
3 years ago
5

In this program we are going to practice using the Math class by computing some important values on the unit circle. Using the a

ngles 0, PI/2, and PI, print out the angle, the cosine of the angle, and the sine of the angle.
Computers and Technology
1 answer:
san4es73 [151]3 years ago
5 0

Answer:

The program in Java is as follows:

import java.lang.Math;

public class Trig{

public static void main(String args[]){

for(double angle = 0; angle <= Math.PI; angle += Math.PI / 2){

double cosX = Math.round(Math.cos(angle)*100.0)/100.0;

double sinX = Math.round(Math.sin(angle)*100.0)/100.0;

System.out.println((Math.round(angle*100)/100.0)+" --> "+cosX +" --> "+ sinX);

}}}

Explanation:

This line imports the math library into the program

import java.lang.Math;

This line defines a class

public class Trig{

This line defines the main method

public static void main(String args[]){

This line is an iteration that iterates from 0, through Math.PI using Math.PI/2 as an interval

for(double angle = 0; angle <= Math.PI; angle += Math.PI / 2){

This calculates the cosine of the angle (in radians)

double cosX = Math.round(Math.cos(angle)*100.0)/100.0;

This calculates the sine of the angle (in radians)

double sinX = Math.round(Math.sin(angle)*100.0)/100.0;

This prints the angle in radians, the cosine and the sine of the angle

System.out.println((Math.round(angle*100)/100.0)+" --> "+cosX +" --> "+ sinX);

}}}

You might be interested in
When records are in ____ order, they are arranged one after another on the basis of the value in a particular field.?
Nat2105 [25]
When records are in ASCENDING order ...
4 0
3 years ago
Lenny copied and pasted content from a commercial website into his research paper without citing his source, passing the work of
Sedbober [7]
Lenny might be either suspended
Or might be failed in that particular course
6 0
9 months ago
Can someone help me with these questions?
REY [17]

website will be the first, hyperlink will be the second, A will be number three, and webpage will be number 4

8 0
3 years ago
Edward scissorhands Of course, Jim is the villain, but who or what is the antagonist in the film? Explain in detail.
Doss [256]
Jim is the main antagonist while Edward is the main protagonist of the movie.
8 0
2 years ago
Why are your interactive ads so broken?
VladimirAG [237]

Answer:

lol truuuue

Explanation:

5 0
2 years ago
Other questions:
  • Some cases have ____, also called spacers, which are round plastic or metal pegs that separate the motherboard from the case, so
    9·1 answer
  • Which ergonomic principle helps to maintain good posture?
    8·2 answers
  • The reliance on _____ as the design methodology for relational databases is seen as a stumbling block to its use in OLAP systems
    5·1 answer
  • Each of the outcomes listed below is a result of executing the following script except for one. Which one? CREATE ROLE ExampleRo
    6·1 answer
  • One of the best ways to shoot a picture is to frame the subject in the middle of the screen or viewer. T or F
    14·2 answers
  • Describe five examples of civil engineering projects.
    6·1 answer
  • Create a file named homework_instructions.txt using VI editor and type in it all the submission instructions from page1 of this
    7·1 answer
  • Keira is creating an app for her cross-country team. Users will input their race times and the output will be a graph showing th
    6·1 answer
  • • Do you think documentaries are best delivered in media such as films or documentary?
    10·1 answer
  • Difference between sorting and filtering​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!