Conversion Help

Reply

Join Date: Oct 2009
Posts: 15
Reputation: kulrik is an unknown quantity at this point 
Solved Threads: 0
kulrik kulrik is offline Offline
Newbie Poster

Conversion Help

 
-1
  #1
Oct 10th, 2009
With this problem. I finished the coding, but my output is displayed in Radians instead of Degrees. Can anyone help? Here's my coding:


public class MyMath
{
public void displaySin()

{ int angle = 0;
System.out.println("Angle\tSin(Angle)\tValue");
while(angle<=360){
final double RADIANCONST=180;
double angleRadian;
angleRadian = Math.sin((RADIANCONST*angle)/RADIANCONST);
System.out.printf("%d\tSin\t(%d)\t%5.2f\n",angle,angle, angleRadian);
angle = angle + 30;
}//end while
}
public static void main(String[]args)
{
MyMath m;
m = new MyMath();
m.displaySin();

}


}//end method
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,574
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 199
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #2
Oct 10th, 2009
angle in degrees = angle in radians * 180 / Pi

Use that formula to fix the output. Or to fix the calculations in your code, wherever your miscalculations may be if you have any.
Out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 15
Reputation: kulrik is an unknown quantity at this point 
Solved Threads: 0
kulrik kulrik is offline Offline
Newbie Poster
 
-1
  #3
Oct 10th, 2009
i tried that. where should I put it?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso
 
0
  #4
Oct 10th, 2009
Originally Posted by kulrik View Post
i tried that. where should I put it?
Show your try, then we can see what you did wrong.
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 15
Reputation: kulrik is an unknown quantity at this point 
Solved Threads: 0
kulrik kulrik is offline Offline
Newbie Poster
 
0
  #5
Oct 10th, 2009
Never Mind I Got It. Thanks
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC