subject

In Java PLease In this program we are going to practice using the Math class by computing some important values on the unit circle. Using the angles 0, PI/2, and PI, print out the angle, the cosine of the angle, and the sine of the angle.

Your output should look like this:

Radians: (cos, sin)
0.0: 1.0, 0.0
1.5707963267948966: 0.0, 1.0
3.141592653589793: -1.0, 0.0
Hints:

You’ll need to use the Math. sin, Math. cos methods
and the Math. PI constant!
You can round a decimal to 2 decimal places by multiplying by 100, rounding to the nearest int using Math. round, and then dividing by 100. You will need to round the sine and cosine values. Here’s an example:
double angle = Math. PI/4;
double cosine = Math. cos(angle); // 0.707106781
cosine = cosine * 100; // 70.7106781
cosine = Math. round(cosine); // 71.0
cosine = cosine / 100.0; // 0.71

// Or put it all on one line:
cosine = Math. round(cosine * 100) / 100.0;

Some Math Background
The Java methods need the angles to be in radians, rather than degrees. PI/2 radians is equal to 90 degrees. PI radians is equal to 180 degrees.
That’s why we’re using multiples of PI in this exercise.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
question
Computers and Technology, 25.06.2019 01:20
Jason typically uses the internet to buy various items. it the total cost of all of the items ordered, at one time, is $250 or more, then the shipping and handling is free, otherwise the shipping and handling is $15 per item. design an algorithm that prompts jason to enter the number of items ordered and the price of each item. (remember cost = number of items order times price) the algorithm then outputs the total billing amount including shipping and handling. your algorithm must use a loop (repetition structure) to get the number and price of each item. write this in algorithm format not program code format.
Answers: 2
You know the right answer?
In Java PLease In this program we are going to practice using the Math class by computing some impo...
Questions
question
Social Studies, 16.08.2020 01:01
question
History, 16.08.2020 01:01
question
Mathematics, 16.08.2020 01:01
question
Engineering, 16.08.2020 01:01
question
Mathematics, 16.08.2020 01:01
Questions on the website: 13722362