星期一, 6月 16, 2008

Quiz 4

1. Write a Java program to calculate the trianular function as follows:
Cos(x)=1 - 2!/x 2 + 4!/x4 - 6!/x6 ...

2. Write a Java program to calculate the sin function as follows:
sin(x)=x - 3!/x 3 + 5!/x5 - 7!/x7 ...

3. Design a non-static method that can compute the product of complex numbers. You must first define Complex class then write a demo program to verify the class program.

4. Design a static method that can compute the product of complex numbers. You must first define Complex class then write a demo program to verify the class program.

5. Let i, j be two integers. Write a Java program to exchange their values. Please make sure you have good styles of making comments, naming variables, and indenting.

6. Write a complete Java program that uses a for loop to compute the sum of the even numbers between 1 and 25.

7. Explain API and ADT.

8. Explain programming styles and naming conventions

沒有留言: