for(int limit1=1; limit1<=1; limit1++){
System.out.print("Number of criteria (Max: 5): ");
int n = Integer.parseInt(inpt.readLine());
System.out.println();
if (n>5 || n<1){
System.out.println("Sorry the maximum limit is 5");
System.out.println("Please try again");
System.out.println();
limit1=limit1-1;
continue;
}
double[] arrayCrit = new double[n];
double[] arrayPerc= new double[n];
String[] arrayCritName = new String[n];
double percentage=0, check=0, cent=0;
for (int i = 0; i < n; i++){
System.out.print("Criteria("+(i+1)+"): ");
arrayCritName[i] = inpt.readLine();
for(int limit2=1; limit2<=1; limit2++){
if(n==1){
arrayCrit[i] = 100/100;
System.out.print("Percentage: 100%");
break;
}
System.out.print("Percentage: ");
arrayCrit[i] = Integer.parseInt(inpt.readLine());
if(arrayCrit[i]>100 || arrayCrit[i]<1){
System.out.println("Sorry, minimum value is 1 and maximum value is 100");
System.out.println("Please try again");
System.out.println();
limit2=limit2-1;
}
check=check+arrayCrit[i];
if(check>100 || check<1){
System.out.println("User didn't meet the default percentage (100%)");
System.out.println(check);
check=check-arrayCrit[i];
limit2=limit2-1;
continue;
}
arrayCrit[i] = arrayCrit[i]/100;
}
}
您好,我在输入百分比时需要帮助。我想知道最后一个输入是否可以自动输入值。
例如:
- 标准数量:3
- 标准(1) - 出勤率
- 百分比:25
- 标准(2) - 测验
- 百分比 - 25
- 标准(3) - 考试
- 百分比 - 50 <--- 自动出现,无需输入。
谢谢!