Java - need help please?

AKIRA

Tank
Joined
Feb 6, 2006
Messages
3,000
Reaction score
2
Im sort of confused. Here's what the question is asking:

"Write a Java program Ass1Q1b. The math library has several built in functions which are very useful. One of those is a toRadians(double) function. Create a table of values which will display the Degree measure in 5 deg increments from 0 to 360, in the left hand column and the Radian measure in the right hand column. Please have appropriate headings on the table."

the table should look something like this:


Degrees Radians
-----------------------------
0 (whatever value)
5 "
10 "
15 "
20 "
etc.. etc..

I'm pretty sure I know how to convert it, but it's just setting up the table that's really confusing...can anyone help please?

THANKS :D
 
Code:
public class radTad{
  
  public static void main(String args[])
  {
    System.out.println("Degrees to radians\n____________________");
    for(int i=0;i<=360;i+=5)
    {
      System.out.println(i+" "+Math.toRadians(i));
    }
  }
}

save it in a file named radTad or change the name of the class, also if you're using ready to pogram java you might want to change the System.out lines to your console object.
 
lol that's a blast from the past, I can't program anymore but I can understand that code perfectly.
 
awesome, thanks guys it worked perfectly..im in 1st year of computer science and we're just starting to do assignments..lol so get ready for more questions from me, next time i'll post this in the coding forum though.

Thanks alot :D
 
awesome, thanks guys it worked perfectly..im in 1st year of computer science and we're just starting to do assignments..lol so get ready for more questions from me, next time i'll post this in the coding forum though.
Thanks alot :D

i dont mean to be rude or anything but its kind of odd that you're in CS and dont have basic programming skills :S. you should really brush up and take some time out to learn the structures. program structures are translated (almost seamelessly) across languages so if you understand all the structures of one language like conditional structures , repetition structures etc. then you can basically program in any environment because the rest is just logic.

edit: just making sure you dont take it the wrong way , i realise that CS isnt all about programming theres a lot of math involved but i just thought it was weird that you would be interested in CS but dont know much about programming.
 
I love you moder. You're a budding programming genius. I aspire to be like you. :cheers:

And thank you again for telling me about Regular Expressions. These things are just mind boggling complex and useful. I haven't figured out how to use them to my needs yet, but I'm working on it!

Interfaces and Custom Collections are still giving me a very hard time though.
 
Lol I'm learning C and even I understood that code :p
 
java is perfect for getting to know the structure of oop languages, and if you know anything else you pretty much can figure out java, especially with all the includes like swing and shit.
 
If you wanna impress the teacher, use a JTable (a Swing component) to put the data in :)
 
Back
Top