CodePudding user response:
Not in the list, please be sure to use an array?CodePudding user response:
import java.util.*;
/* *
* @ author zhaojinhui
* @ date 2020/12/29 9:51
* @ apiNote
*/
Public class Score {
Public static void main (String [] args) {
The Integer [] scores=new Integer [100].
Scanner Scanner=new Scanner (System. In);
int i=1;
System. The out. Println (" please enter a number, press 1 end ");
While (I & lt; {
=100)i++;
Int inNum=scanner. NextInt ();
System. The out. Println (" please enter a number, press 1 end ");
If (inNum==1) {
break;
} else {
Scores [I]=inNum;
}
}
ListList=new ArrayList<> (a);
Collections. AddAll (list, scores);
List. RemoveAll (Collections. The singleton (null));
List. The forEach (System. Out: : println);
DoubleSummaryStatistics statistics=list. Stream (). MapToDouble (Number: : doubleValue). SummaryStatistics ();
System. The out. Println (" points: "+ statistics. GetMax ());
System. The out. Println (" minimum points: "+ statistics. GetMin ());
System. The out. Println (" average: "+ Math. Round (statistics) getAverage ()));
System. The out. Println (" total points: "+ statistics. GetSum ());
System. The out. Println (" total number: "+ statistics. GetCount ());
}
}
CodePudding user response:
The