有问题不会分都给了

CSDN998701245 2019-12-23 04:21:23
有没有人会这个阿,小白有点懵。。
...全文
37 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
你看见了吗° 2019-12-23
  • 打赏
  • 举报
回复
num/10是取整,余数不被计算,所以
分数60-79的值为6.7,
分数80-89的值为8,
分数90-100的值为9.10
_Ricky_ 2019-12-23
  • 打赏
  • 举报
回复
public static void getFinalScore(int score) {
        if( 100 < score || score < 0){
            System.out.println("请输入正确的成绩!!!");
            return;
        }
        System.out.println("卷面成绩:"+ score);
        switch (score / 10) {
            case 10:
                System.out.println("100分,你很优秀!");
                break;
            case 6 | 7 :
                System.out.println("最终得分:" + (score * 0.5));
                break;
            case 8:
                System.out.println("最终得分:" + (score * 0.45));
                break;
            case 9:
                System.out.println("最终得分:" + (score * 0.4));
                break;
            default:
                System.out.println("最终得分:" + (score * 0.6));
        }
    }
你看见了吗° 2019-12-23
  • 打赏
  • 举报
回复

public static void main(String[] args) {
test(30,"A");
test(60,"B");
test(85,"C");
test(92,"D");
}
/**
*
* @describe
* @param num 分数
* @param name 姓名
*/
public static void test(int num,String name){
double score = 0.0;
switch(num/10) {
case 6:
score = num*0.5+50;
break;
case 7:
score = num*0.5+50;
break;
case 8:
score = num*0.45+50;
break;
case 9:
score = num*0.4+50;
break;
case 10:
score = num*0.4+50;
break;
default:
score = num*0.6+50;
break;
}
System.out.println(name+"的分数:"+score);
}
淡青の月 2019-12-23
  • 打赏
  • 举报
回复
int[] mark = { 30, 60, 85, 92 };
double coefficient = 1;

for (int i = 0; i < mark.length; i++) {
int score = 50;
int m = mark[i];
System.out.println(m);
switch (m < 60 ? 1 : m < 80 ? 2 : m < 90 ? 3 : 4) {
case 1:
coefficient = 0.6;
break;
case 2:
coefficient = 0.5;
break;
case 3:
coefficient = 0.45;
break;
case 4:
coefficient = 0.4;
break;
}
score += coefficient*m;
System.out.println("最终成绩为:"+ score);
}
qybao 2019-12-23
  • 打赏
  • 举报
回复
for example

public class Main {
public static void main(String[] args) {
int score_usually = 50;
System.out.printf("A base:30, score:%.2f\n", score_usually + getTestScore(30));
System.out.printf("B base:60, score:%.2f\n", score_usually + getTestScore(60));
System.out.printf("C base:85, score:%.2f\n", score_usually + getTestScore(85));
System.out.printf("D base:92, score:%.2f\n", score_usually + getTestScore(92));
}

public static double getTestScore(int base) {
double rate[] = {0.6, 0.5, 0.45, 0.4};
double score = 0;
switch (base/60) {
case 0:
score = base * rate[0];
break;
default:
switch (base/80) {
case 0:
score = base * rate[1];
break;
default:
switch (base/90) {
case 0:
score = base * rate[2];
break;
default:
score = base * rate[3];
}
}
}
return score;
}
}
CSDN998701245 2019-12-23
  • 打赏
  • 举报
回复
有没有老哥给看一下啊

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧