‍Build a scoring system , give the score by referee , and entering the score in system , then take out the max score and the min score , print the final score in the window .

‍做了一个打分系统,用户输入获得的分数,然后去掉一个最高分,去掉一个最低分,然后打印输出最终得分。

️练习数组的使用,定义数组,遍历数组,以及求数组的最值操作。

️练习定义方法和调用方法。

代码如下:

import java.util.Arrays;
import java.util.Scanner; public class score {
public static void main(String[] args) {
//定义数组,长度为7
int[] arr = new int[7];
//用户输入分数,并写进数组内
Scanner in = new Scanner(System.in);
for (int i = 0; i < arr.length; i++) {
System.out.println("请输入第" + (i + 1) + "个裁判的分数");
arr[i] = in.nextInt();
}
//通过Arrays.stream().获取值
int min = Arrays.stream(arr).min().getAsInt();
int max = Arrays.stream(arr).max().getAsInt();
int sum = Arrays.stream(arr).sum();
System.out.println(max);
System.out.println(min);
System.out.println(sum);
//通过定义的方法获取最值
System.out.println("getMax" + getMax(arr));
System.out.println("getMin" + getMin(arr));
//计算最终得分
int score = (sum-min-max)/(arr.length-2);
System.out.println("你的最终得分是:"+score+"分!!!");
}
//定义getMax的方法(返回值int,参数Arrays)(成员函数)
public static int getMax(int[] arr) {
int num = arr[0];
for (int i = 0; i < arr.length; i++) {
if (num < arr[i]) {
num = arr[i];
}
}
return num;
}
//定义getMax的方法(返回值int,参数Arrays)(成员函数)
public static int getMin(int[] arr) {
int num = arr[0];
for (int i = 0; i < arr.length; i++) {
if (num > arr[i]) {
num = arr[i];
}
}
return num;
}
}

Scoring System的更多相关文章

  1. Common Vulnerability Scoring System CVSS

    1.Generating a Shell payload using msfvenom 2.web intrusion Test in fact in the websecurity ,the web ...

  2. Scoring and Modeling—— Underwriting and Loan Approval Process

    https://www.fdic.gov/regulations/examinations/credit_card/ch8.html Types of Scoring FICO Scores    V ...

  3. Bioinformatics Glossary

    原文:http://homepages.ulb.ac.be/~dgonze/TEACHING/bioinfo_glossary.html Affine gap costs: A scoring sys ...

  4. Threat Risk Modeling Learning

    相关学习资料 http://msdn.microsoft.com/en-us/library/aa302419(d=printer).aspx http://msdn.microsoft.com/li ...

  5. Notes of Linked Data concept and application - TODO

    Motivation [反正债多了不愁,再开个方向.] Data plays a core role in most business systems, data storage and retrie ...

  6. Android开源项目SlidingMenu深切解析

    demo:http://download.csdn.net/detail/javadxz/6954819 SlidingMenu的是一种斗劲新的设置界面或设备界面结果,在主界面左滑或者右滑呈现设置界面 ...

  7. The 2014 ACM-ICPC Asia Regional Anshan Online

    [A]无向图的双联通子图计数.DP+状态压缩 [B]计算几何(点的旋转) [C]DP+状态压缩 [D]离散数学+DP (感觉可出) [E]概率DP [F]LCT模板题(-_-///LCT是啥!!!!) ...

  8. CVSS3.0打分学习

    打分计算器: Common Vulnerability Scoring System Version 3.0 Calculator: https://www.first.org/cvss/calcul ...

  9. hdu5003 Osu!排序实现水题

    Osu! is a famous music game that attracts a lot of people. In osu!, there is a performance scoring s ...

随机推荐

  1. idea启动项目address localhost:1099 is already in use异常解决

    IDEA中启动Tomcat报错,Error running Tomcat7.0.52: Address localhost:1099 is already in use 或者是 java.rmi.se ...

  2. 时间&空间(complexity)

    时间&空间复杂度 时间复杂度: 通俗来说就是随着数据量的增加,程序运行的时间花费量是怎么变化的,时间复杂度常用大o表示.举个例子,猜数字,猜10个,100个.1000个,猜数的数据量是在增加的 ...

  3. IPFS挖矿赚钱吗?IPFS挖矿是真的吗?

    IPFS一出现就获得了极高的关注度,「让人类信息永存」的口号也让其蒙上了一层神秘的面纱.今天我就来给大家自剖析,一探IPFS技术的真相. IPFS是一个去中心化存储网络,而Filecoin是IPFS激 ...

  4. PTA 统计二叉树度为2的结点个数

    6-4 统计二叉树度为2的结点个数 (11 分)   本题要求实现一个函数,可统计二叉树中度为2的结点个数. 函数接口定义: int NodeCount ( BiTree T); T是二叉树树根指针, ...

  5. [源码解析] 并行分布式框架 Celery 之架构 (2)

    [源码解析] 并行分布式框架 Celery 之架构 (2) 目录 [源码解析] 并行分布式框架 Celery 之架构 (2) 0x00 摘要 0x01 上文回顾 0x02 worker的思考 2.1 ...

  6. 「HTML+CSS」--自定义按钮样式【001】

    前言 Hello!小伙伴! 首先非常感谢您阅读海轰的文章,倘若文中有错误的地方,欢迎您指出- 哈哈 自我介绍一下 昵称:海轰 标签:程序猿一只|C++选手|学生 简介:因C语言结识编程,随后转入计算机 ...

  7. SFDC 利用Schema.Describe来取得Picklist所有的选项

    Salesforce的开发语言Apex与Java极为类似.也有封装,基础,多态特性. 并且也能 反射,Object的属性和Field属性. 今天主要记录的是一个需求:Visualforce Page或 ...

  8. 使用 Android Studio 开发 widget 安卓桌面插件

    •What AppWidget 即桌面小部件,也叫桌面控件,就是能直接显示在Android系统桌面上的小程序: 这么说可能有点抽象,看图: 像这种,桌面上的天气.时钟.搜索框等等,都属于 APP Wi ...

  9. 解决send-mail: fatal: parameter inet_interfaces: no local interface found for ::1

    1:检查sendmail服务的状态 service sendmail status 2:开启sendmail服务 service sendmail start3:关闭sendmail服务 servic ...

  10. vue-router 监控全局路由,在路由中改变vuex中的状态值