1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MaRussiya [10]
3 years ago
5

In this program we are going to practice using the Math class by computing some important values on the unit circle. Using the a

ngles 0, PI/2, and PI, print out the angle, the cosine of the angle, and the sine of the angle.
Computers and Technology
1 answer:
san4es73 [151]3 years ago
5 0

Answer:

The program in Java is as follows:

import java.lang.Math;

public class Trig{

public static void main(String args[]){

for(double angle = 0; angle <= Math.PI; angle += Math.PI / 2){

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((Math.round(angle*100)/100.0)+" --> "+cosX +" --> "+ sinX);

}}}

Explanation:

This line imports the math library into the program

import java.lang.Math;

This line defines a class

public class Trig{

This line defines the main method

public static void main(String args[]){

This line is an iteration that iterates from 0, through Math.PI using Math.PI/2 as an interval

for(double angle = 0; angle <= Math.PI; angle += Math.PI / 2){

This calculates the cosine of the angle (in radians)

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

This calculates the sine of the angle (in radians)

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

This prints the angle in radians, the cosine and the sine of the angle

System.out.println((Math.round(angle*100)/100.0)+" --> "+cosX +" --> "+ sinX);

}}}

You might be interested in
A. True <br><br> b. False: most modern computers can understand and execute pseudocode.
Veronika [31]
False






---------------------------------------------
7 0
3 years ago
Write a loop that reads positive integers from console input, printing out those values that are even, separating them with spac
zvonat [6]

Hello, since you did not specify a programming language, I wrote this algorithm in C++. Good luck!

<h2>Code:</h2>

#include <iostream>

#include <vector>

std::vector<int> v;

int main(int argc, char* argv[]) {

   while(1) {

   int temp;

   std::cout << "\nEnter a number: ";std::cin>>temp;

   

   if(temp<0) {

       std::cout << "\nEven number(s) is/are:\n---------------------\n";

       for(int i=0;i<v.size();i++) {

           if(v.at(i)%2==0) std::cout << v[i] << " ";

           else continue;

       }

       std::cout << std::endl;

       break;

   }else {

       v.push_back(temp);

   }

}

   return 0;

}

4 0
2 years ago
The most direct way for Jonothan to gain on-the-jib experience and earn money while attending school is to apply for
Sholpan [36]
A part-time job would provide on-the-job experience while also giving him a flexible schedule competing with school.
4 0
4 years ago
True or false you have no control over who views your social network information
il63 [147K]
  Your answer would be false. That's what you have security settings for.
4 0
4 years ago
Read 2 more answers
Mobile legends new hero in october aamon is coming in october 26th
defon

Answer:

yellow

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Design a class called NumDays. The class’s purpose is to store a value that represents a number of work hours and convert it to
    13·2 answers
  • Inserting diagrams into documents can help readers better understand document text. True or False?
    10·1 answer
  • Individuals who require better speed and performance for graphics-intensive applications (e.g., video editing, gaming, etc.) pre
    8·1 answer
  • Which statement describes a mobile device feature? Docking stations can add some functionality to mobile devices such as video o
    11·1 answer
  • Jackson is teaching a class the concept of the binary number system. Which term will he use to refer to the leftmost bit of a bi
    11·2 answers
  • ____ technology is the same as that used in digital watches, or the time display on a microwave oven
    14·1 answer
  • If Digital Assistants are free to use why companies do spend millions of dollars to develop and support them?
    8·1 answer
  • Which three of the following statements are true about using a WYSIWYG editor?
    10·2 answers
  • Which pair of devices have the same input motion and different outputs?
    15·1 answer
  • I don't know what to do for these two questions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!