Java问题紧急!!!!!
来源:百度知道 编辑:UC知道 时间:2024/06/17 18:41:32
Develop a window based application using java applet, which perform the following three mathematical functions:
• Compute the factorial of a given number
• Determine if a given number is a “Prime Number”
• Compute the standard deviation of a set of numbers
The applet show look as follow as a main menu:
图1
下一部分:Once a function is selected, following windows will be displayed:
The definition of each of the functions is given below
Definition for Factorial :
Factorial of a given number is denoted by n!, it is the product of all the positive integer less than or equal to n.
For example 5! = 1 x2 x3 x 4 x 5 = 120
Definition for Prime Number :
A prime number is a positive integer that has exactly two positive integer factors, 1 and itself.
For example, if we list the factors of 28, we have 1, 2, 4, 7, 14, and 28. That's six factors.
• Compute the factorial of a given number
• Determine if a given number is a “Prime Number”
• Compute the standard deviation of a set of numbers
The applet show look as follow as a main menu:
图1
下一部分:Once a function is selected, following windows will be displayed:
The definition of each of the functions is given below
Definition for Factorial :
Factorial of a given number is denoted by n!, it is the product of all the positive integer less than or equal to n.
For example 5! = 1 x2 x3 x 4 x 5 = 120
Definition for Prime Number :
A prime number is a positive integer that has exactly two positive integer factors, 1 and itself.
For example, if we list the factors of 28, we have 1, 2, 4, 7, 14, and 28. That's six factors.
什么意思??
是要算法吗?
第一个 求阶层的
int i,temp=1;
for(i=?;i<0;i--){
temp*=i;
}
//temp就是要的阶层 ?是你要求阶层的数字
第二个 求指数的
int c=0;
boolean b=false;
for(int i=?1;i<?2;i++){
b=true;
for(int j=2;j<=i/2;j++){
if(i%j==0)
b=false;
}
if(b){
System.out.print(i+" ");
}
}
//?1是取你要取值的最小值 ?2是你要取值的最大值
我想你要的应该是这个吧