📄 poissonapp.java
字号:
import java.util.*;
class PoissonApp
{
//----------------FIELDS--------------
private static Scanner input =
new Scanner(System.in);
//---------------METHODS---------------
public static void main(String[] args)
{
//Input a
System.out.print("Please input the average arrival rate of customers:");
int a = input.nextInt(), i;
long x;
double poisson_X;
//When A is greater than five
if ((a > 5) && (a <= 10))
{
System.out.printf("\n==================================");
System.out.printf("\n| Number of " + "|" + " Poisson |" +
"\n| Customers " + "|" + " Probability |" +
"\n| (X)" + " |" + "\t\t |");
System.out.printf("\n| --------------+--------------- |");
for (i = a - 5; i <= a + 5; i++)
{
Poisson newPoisson = new Poisson(a,i);
newPoisson.calcPoisson();
poisson_X = newPoisson.getPoisson_X();
System.out.printf("\n|\t" + i + "\t|");
System.out.printf(" %.6f |", poisson_X);
}
System.out.printf("\n==================================");
}
//When A is less than or equal to five
else if((a>0)&&(a<=5))
{
System.out.printf("\n==================================");
System.out.printf("\n| Number of " + "|" + " Poisson |" +
"\n| Customers " + "|" + " Probability |" +
"\n| (X)" + " |" + "\t\t |");
System.out.printf("\n| --------------+--------------- |");
for (i = 1; i <= a + 5; i++)
{
Poisson newPoisson = new Poisson(a, i);
newPoisson.calcPoisson();
poisson_X = newPoisson.getPoisson_X();
System.out.printf("\n|\t" + i + "\t|");
System.out.printf(" %.6f |", poisson_X);
}
System.out.printf("\n==================================");
}
//When A is the integer out of the range
else
{
System.out.print("\nError! Please check your input!\n");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -