我数学很弱,我需要一些关于最小值和最大值计算的帮助吗?
假设将MinValue 视为 200 ,将 MaxValue 视为 1000。
将MinValue 和 MaxValue 除以 5(对我来说,这里只需要显示五个值)
下面是我实现的代码。
double initalValue = 200;
double finalValue = 1000;
double range = finalValue - initalValue;
double designCalRange = range/5;
double intialrange = initalValue;
System.out.println("designCalRange::>"+designCalRange);
System.out.println("AtuaValue::>"+Math.ceil(intialrange));
System.out.println("RoundOffValue::>"+Math.ceil(intialrange/100)*100 + "\n");
for (double i = 1; i<=5;i++){
intialrange += designCalRange;
System.out.println("\n"+"AtuaValue::>"+Math.ceil(intialrange));
System.out.println("RoundOffValue::>"+Math.ceil(intialrange/100)*100);
}
}
我的输出是**
RoundOffValue::>200.0
RoundOffValue::>400.0
RoundOffValue::>600.0
RoundOffValue::>700.0
RoundOffValue::>900.0
RoundOffValue::>1000.0
**
但它应该是:
RoundOffValue::>200.0
RoundOffValue::>400.0
RoundOffValue::>600.0
RoundOffValue::>800.0
RoundOffValue::>1000.0