首页 > 代码库 > 学习笔记
学习笔记
package com.ctgu.java.exer; import java.util.Scanner; public class TestStudentScore { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("请输入学生的个数" ); int count = s.nextInt(); int[] scores =new int[count]; int maxScore = 0; System.out.println("请输入"+ count +"个成绩5" ); for(int i = 0; i<scores.length;i++){ int score = s.nextInt(); scores[i] = score; if(scores[i] > maxScore){ maxScore = scores[i]; } } System.out.println("最高分为:"+ maxScore); for(int i = 0;i < scores.length;i++){ char level; if( scores[i] >= maxScore-10){ level = ‘A‘; }else if( scores[i] >= maxScore-10){ level =‘B‘; }else if( scores[i] >= maxScore-20){ level = ‘C‘; }else{ level = ‘D‘; } System.out.println("student " +i+ " score is "+scores[i]+"5grade is "+ level); } // TODO Auto-generated method stub } }
学习笔记
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。