Trouble to help teachers to look at me to write? Is there anything that's good, some people say that I write this strange
In
Public class Random_05 {
Public static void main (String [] args) {
ArrayListArray1=getScoreList ();
ArrayListArray2=countScore (Array1);
System. The out. Println ("=====================");
PrintConut (Array2);
}
Public static ArrayListGetScoreList () {
ArrayListArray=new ArrayList<> (a);
Random random=new Random();
for (int i=0; I & lt; 50; I++) {
Int num1=random. NextInt (100);
System. The out. Println (num1);
Array. The add (num1);/////////////////////////
}
return array;
}
Public static ArrayListCountScore (ArrayList Array) {
ArrayListArray2=new ArrayList<> (a);//statistics the number of each band
Int a=0, b=0, c=0, d=0;
for (int i=0; I & lt; Array. The size (); I++) {
Int num2=array. Get (I);
If (num2 & lt;=100 & amp; & Num2 & gt; {
=80)+;
} else if (num2 & lt;=79 & amp; & Num2 & gt;=60) {
b++;
} else if (num2 & lt;=59 & amp; & Num2 & gt; 40)={
C + +;
} else if (num2 & lt;=39 & amp; & Num2 & gt;=0) {
D++;
}
}
Array2. Add (a);
Array2. Add (b);
Array2. Add (c);
Array2. Add (d);
Return array2;
}
Public static void printConut (ArrayListArray2) {
for (int i=0; I & lt; Array2. The size (); I++) {
System. The out. Println (array2. Get (I));
}
}
}
CodePudding user response:
If purely in order to meet the topic request, from the code it's nothing serious, just score will not be 100, random. NextInt (100); To the random. NextInt (101);CodePudding user response: