Computers and Technology

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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 10:50, Leffew
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, BIKRAMlawati5544
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
image
Computers and Technology, 24.06.2019 02:30, cardsqueen
Which option completes the explanation for conflict of interest in an organization
Answers: 1
image
Computers and Technology, 24.06.2019 07:30, LuckyCharms988
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
Do you know the correct answer?
In this program we are going to practice using the Math class by computing some important values on...

Questions in other subjects:

Konu
Mathematics, 29.12.2019 07:31
Konu
History, 29.12.2019 07:31