首页 > 其他 > 详细

学习笔记

时间:2015-01-09 01:41:25      阅读:184      评论:0      收藏:0      [点我收藏+]
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

	}

}


学习笔记

原文:http://9815936.blog.51cto.com/9805936/1600886

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!