题解 | 学生综合评估系统

学生综合评估系统

https://www.nowcoder.com/practice/d8d5d6294b8f48b684ea93fbb4935a2b

import java.util.*;

public class Main {
    static class Student {
        int id;
        int academic_score;
        int activity_score;

        public Student(int id, int academic, int activity) {
            this.id = id;
            this.academic_score = academic;
            this.activity_score = activity;
        }
    }

    static boolean isExcellent(Student student) {
        // TODO: 实现优秀标准的判断逻辑
        if ((student.academic_score + student.activity_score > 140) &&
                (0.7 * student.academic_score + 0.3 * student.activity_score >= 80)) {
            return true;
        } else {
            return false;
        }

    }



    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        for (int i = 0; i < n; i++) {
            int id = scanner.nextInt();
            int academic = scanner.nextInt();
            int activity = scanner.nextInt();
            Student student = new Student(id, academic, activity);

            if (isExcellent(student)) {
                System.out.println("Excellent");
            } else {
                System.out.println("Not excellent");
            }
        }
        scanner.close();
    }
}

全部评论
点赞 回复 分享
发布于 01-26 15:57 山东

相关推荐

牛客96931767...:这履历不是在网安横着走啊
大家都开始春招面试了吗
点赞 评论 收藏
分享
柱柱想躺平:这是好事啊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务