{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "f5e2e3b7527d490a85584780762a813f",
  "keywords": "桶排序,算法初阶,线性时间排序,排序和顺序统计量",
  "title": "按以下要求实现程序功能",
  "desc": [
    {
      "content": "\n<p>从键盘输入5个整型值\n1&#xff09;按从大到小顺序排序方法&#xff1b;\n2&#xff09;计算这些数的平均值的方法&#xff1b;\n3&#xff09;在主方法中调用这些方法&#xff0c;并输出相应的值。</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "java"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ]
  ],
  "template": {
    "content": "import java.util.*;\nclass java_7445932 {\n\tpublic static void main(String[] args) {\n\t\tList<Integer> list = new ArrayList<>();\n\t\tScanner scanner = new Scanner(System.in);\n\t\tfor (int a = 1; a < 6; a++) {\n\t\t\tSystem.out.print(\"请输入第 \" + a + \" 个值：\");\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tSystem.out.println(descending(list));\n\t\tSystem.out.println(getAvg(list));\n\t}\n\tpublic static List<Integer> descending(List<Integer> list) {\n\t\tlist.sort(Collections.reverseOrder());\n\t\treturn list;\n\t}\n\tpublic static Double getAvg(List<Integer> list) {\n\t\treturn list.stream().mapToInt(Integer::new).average().getAsDouble();\n\t}\n}",
    "language": "java"
  },
  "node_id": "dailycode-8c4886e800094c849c6eec647e0c04b7",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600469877"
}