A mathematical table.
No. 102
Nicely formatting sine values.
Q: |
We are interested in the following output presenting the sine function rounded to three decimal places: x | sin(x) ----+------ 0 | 0.000 5 | 0.087 10 | 0.174 15 | 0.259 20 | 0.342 ----+------- 25 | 0.423 30 | 0.500 35 | 0.574 40 | 0.643 ----+------- ... (left out for brevity's sake) ----+------- 325 |-0.574 330 |-0.500 335 |-0.423 340 |-0.342 ----+------- 345 |-0.259 350 |-0.174 355 |-0.087 You may also generate HTML output. Write a corresponding Java application producing this output. You will have to deal with alignment problems, leading spaces, padding zeros and so on. Though more sophisticated support exists the following hints will fully suffice:
|
A: |
|