In this program we are going to practice using the Math class by computing some important values on the unit circle. Starting at 0 and going up by
PI/4 radians (or 45 degrees), print out information of the format below.
Radians: (cos, sin)
0.0: 1.0, 0.0
0.79: 0.7, 0.71
1.57: 0.0, 1.0
2.36: -0.71, 0.7
3.14: -1.0, 0.0
3.93: -0.7, -0.71
4.71: 0.0, -1.0
5.5: 0.71, -0.71
Hints:
You’ll need to use the Math.sin, Math.cos methods
and the Math.PI constant!
You’ll also need to loop from 0 to 2*PI
You can round a decimal to 2 decimal places by multiplying by 100, rounding to the nearest int, and then dividing by 100. Here’s an example:
double value = 0.431675;
value = value * 100; // 43.1675
value = Math.round(value) // 43.0
value = value / 100.0; // 0.43
// Or put it all on one line:
value = Math.round(value * 100) / 100.0;

Answers

Answer 1

Answer:

The program in Java is:

import java.lang.*;

public class MyClass {

   public static void main(String args[]) {

     for(int i= 0;i<360;i+=45){          

         double angle = Math.round(Math.toRadians(i)*100.0)/100.0;

         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(angle+": "+cosX +" "+ sinX);

     }

   }

}

Explanation:

This line iterates through the angles from 0 to 360 or 0 to 2*Pi

for(int i= 0;i<360;i+=45){          

This calculates the angle to radians

         double angle = Math.round(Math.toRadians(i)*100.0)/100.0;

This calculats the cosine of the angle rounded to 2 decimal place

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

This calculats the sine of the angle rounded to 2 decimal place

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

This prints the required output          

         System.out.println(angle+": "+cosX +" "+ sinX);

     }


Related Questions

Write the command and explain about each formula in MS Excel


1. SUM

2. AVERAGE

3. MAx

4. MIN

5. COUNT

Answers

Answer:

1. SUM  --- The SUM function is used to sum all the values that are in a given range. Thus, for example, if you want to add the values between cells A1 and A3, you must write the following command: =SUM(A1:A10)

2. AVERAGE  --- The AVERAGE function allows you to average a range of values, throwing the average of these values in the cell where the function is typed. For example, if you want to average the values included between B1 and B3, you should write the following function: =AVERAGE (B1: B3).

3. MAX --- The MAX function, for its part, returns the maximum value of the values included in the function. For example, if the maximum value included between the values C1 and C3 is known, the following function must be written: =MAX (C1: C3).

4. MIN  --- The MIN function, in turn, allows to identify the minimum value of the range of values included in the function. For example, if the minimum value included between the values D1 and D3 is known, the following function must be written: =MIN (D1: D3).

5. COUNT --- The COUNT function, finally, is used to count all the cells that have numbers, which have been included in the range of the function. For example, if you want to count all cells that contain numbers between the values E1 and E3, you must write the following function: =COUNT (E1: E3).

Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length() methods from the String class You must not use any other String methods, and you must not use any of the methods in the Character class. You may not use any integer literal values except for 0 and 1.

Answers

Ieisiwizudhrhejwjjsjrjrjje

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

Other Questions
tell me how to answer this please I WILL MARK BRAINLIEST If it costs $1.40 per square foot to install the garden, what is the cost for plan A? Plan B? Which form, of plan of federal government suggested greater power for the states?A) Virginia plan B) New Jersey plan C) legislature UMMMM I NEED MORE HELP PLZ need help asap please what is 1+1 please help A parallel circuit contains four identical lamps. The current through the energy source is 4 A. The total resistance of the circuit is 10 . What is the voltage across the energy source and across each lamp What causes a raindrop tochange shape?A.the ground that it lands onB.the air that pushes against itC.the cloud that it falls from Which is the best evidence that continental plates continue to move?A recurring weather patternsB predictable cycles of solar eventsC glacial movement and calvingD volcanic activity along the ring of fire 3x+2y=46 x+y=17 how u solve (BRAINLIEST) and more in the description.Confession: I suck at math lol......Description and benefits: The person with the correct answer will be given 30 points, brainliest, five-star rating, and a thanks. If you answer incorrectly just to get rewards you will be reported to Brainly and your answer will be deleted to give someone else a chance. I need help with #15 please and thanks. Writing a descriptionDescribe a journey by bus as suggested by this picture[40 marks] Please help!!!!! will give brainliest!!! thank you so so so much, I really appreciate it MULTIPLE CHOICE!!!!!! SOMEBODY PLZ ANSWER THIS IT HAS NOT BEEN ANSWERED!!!!Mark ALL that apply. A good definition typically includes _____.A. the subject being definedB. its classificationC. obvious detailsD. a description The magnitude and direction of two vectors are shown in the diagram. What is the magnitude of theirsum?213545620 help me yall like sis Find the inequality by the graph Can someone give me some facts about the Election of 1808? Like some facts that an 8th grader would use and the teacher would think I did it- Use the information below go answer the three questions.In a certain city in France, they gain 2 minutes of daylight each day after the spring equinox (usually in March), but after the autumnal equinox (usually in September) they lose 2 minutes of daylight each day.