subject

In this program we are going to practice using the Math class by computing some important values on the unit circle. Using the angles , 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); 11 8.707106781 cosine = cosine * 188; 770.7186781 cosine = Math. round(cosine); 71.0 cosine = cosine / 158.0; 108.71 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; W 70.7106781 cosine Math. round(cosine); // 71.0 cosine cosine / 100.8; // 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 P/2 radians is equal to 90 degrees. Pl radians is equal to 180 degrees That's why we're using multiples of Pl in this exercise. 1 import java. lang. Math; 2 public class Unitcircle 3- FILES Unit Circle Java 4 5- 6 7 8 9 10 11 12 13 public static void main(String[] args) { System. out. println("Radians: (cos, sin)"); // Put your code here! double pi - Math. PI; double radianvalue; double sinvalue; double cosValue; 14 15 16 17- 18 fon(double 1 e; i<2 pi; i -it (pi/2)) { radianValue - (1 100)/100.8; 19 20 21 22 sinvalue - Math. round(Math. sin(1) "100) / 100.e; cosValue - Math. round(Math. cos(i)* 100) / 100.0; System. out. println(radianvalue + ": "+cosValue" sinvalue); 23 24 25 26 27 28 29 Run Code ✓ Check Code 1 STOP Radians: (cos, sin) 0.0: 1.0, 0.0 1.5707963267948966: 0.0, 1.0 3.141592653589793: -1.0, 0.0 4.71238898038469: 0.0-1.0 Has output ✓ Good work Х Has correct number of output lines Make sure you are printing out the result for 0, PI/2, and Pl (4 lines total) Expected result Radians: (cos, sin) 0.0: 1.0, 0.0 1.5707963267948966: 0.0, 1.0 3.141592653589793: -1.0, 0.0 Your result: Radians: (cos, sin) 0.0: 1.0, 0.0 1.5707963267948966: 0.0, 1.0 3.141592653589793; -1.0, 0.0 4.71238898038469: 0.0 -1.0 Difference Radians: (cos, sin) 0.0: 1.0, 0.0 1.5707963267948966: 9.0, 1.0 3.14159 2653589793: -1.0, 0.0 4.712388980384692 0.0 -110

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Business professionals of america, and future business leaders of america – phi beta lambda are both open to business students at which levels? check all that apply. elementary school middle school high school college
Answers: 1
question
Computers and Technology, 22.06.2019 02:00
What is the largest decimal number that can be represented by a binary number with 4 place values? (remember, each place in a binary number has a value of a power of 2, starting in the ones place with 20.)
Answers: 3
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
You know the right answer?
In this program we are going to practice using the Math class by computing some important values on...
Questions
question
Engineering, 18.11.2020 14:00
question
Mathematics, 18.11.2020 14:00
question
Social Studies, 18.11.2020 14:00
question
English, 18.11.2020 14:00
Questions on the website: 13722361