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 14:30
Including a space in the file name causes problems on all operating systems?
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
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
Health, 06.10.2020 14:01
question
Advanced Placement (AP), 06.10.2020 14:01
question
Biology, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
question
Social Studies, 06.10.2020 14:01
question
Mathematics, 06.10.2020 14:01
Questions on the website: 13722359