星期五, 11月 09, 2007

Quiz 11/9/2007

There are 3 problem each with its own marks. Total above 75 marks is considered as PASS.

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

2. (30)

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

3. (70) Write a program to calculate average science scores by gender based on the following data, where F stands for female and M for male.

M 82
M 65
F 88
M 63
F 75
F 90
F 90
M 70

You should be able to allow users to type in a whole line such as F 80 followed by next line M 70.




2 則留言:

Unknown 提到...

sin(x)=x - 3!/x 3 + 5!/x5 - 7!/x7 ...
老師不好意思,我回去查了一下,sin(x)應該是
sin(x)=x - x3/3! + x5/5! - x7/7! ...

Yao Jen 提到...

Exactly, you are the third one who finds out. However, it does not influence the programming.