package box5;import javax.swing.JOptionPane;public class Transcript { /**
 * @param args
 */
public static void main(String[] args) {
// TODO 自动生成方法存根

//提示用户输入学生总人数并接收该人数值
int totalStudentsValue = Integer.parseInt(JOptionPane.showInputDialog(null,"请输入学生的总人数"));

//定义数组接收学生姓名和成绩
String[] ArrayName = new String[totalStudentsValue];
int[]   ArrayGrade = new int[totalStudentsValue];

//提示用户输入学生姓名并接收
for(int i = 0;i < ArrayName.length;i++){
  String studentsName = JOptionPane.showInputDialog(null,"请输入第" + (i + 1) + "个学生的姓名");
  ArrayName[i] = studentsName;

}
//提示用户输入学生成绩
for(int j = 0;j < ArrayGrade.length;j++){
  int grade = Integer.parseInt(JOptionPane.showInputDialog(null,"请输入" + ArrayName[j] + "的成绩"));
  ArrayGrade[j] = grade;
}
    

//把学生成绩从小到大排列
int temp = 0;
for(int h = 0;h < ArrayGrade.length;h++){
  for(int u = 0;u < ArrayGrade.length - 1 - h;u++){
if(ArrayGrade[u] > ArrayGrade[u+1]){
               temp = ArrayGrade[u];
               ArrayGrade[u] = ArrayGrade[u + 1];
               ArrayGrade[u + 1] = temp;
 }
}

}
//降幂输出成绩
String output2 = "";
for(int a = totalStudentsValue - 1;a >= 0;a--){
output2 += ArrayName[a] + "     " + ArrayGrade[a] + "     \n";

}
JOptionPane.showMessageDialog(null, "" + output2); }}

解决方案 »

  1.   


    // 把学生成绩从小到大排列
    int temp = 0;
    String tempName;
    for (int h = 0; h < ArrayGrade.length; h++) {
    for (int u = 0; u < ArrayGrade.length - 1 - h; u++) {
    if (ArrayGrade[u] > ArrayGrade[u + 1]) {
    temp = ArrayGrade[u];
    ArrayGrade[u] = ArrayGrade[u + 1];
    ArrayGrade[u + 1] = temp;

    tempName = ArrayName[u];
    ArrayName[u] = ArrayName[u + 1];
    ArrayName[u + 1] = tempName;
    }
    }
    }
      

  2.   


    blush prom dresses
    blush prom dresses 2010 from Prom Dresses 2010 now sign up=free shipping this week. free tailor-made,7days refund be free to check the fabric before your purchase
    Prom Dresses 2010