import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Enter the number of students: ");
         int numberOfStudents = input.nextInt();

         System.out.print("Enter " + numberOfStudents + " scores: ");
         int[] score = new int[numberOfStudents];
         int best = 0;
         for(int i = 0 ; i < numberOfStudents; i++)
         {
             score[i] = input.nextInt();
             if(score[i] >= best)
                 best = score[i];
         }

         input.close();

         for(int i = 0 ; i < numberOfStudents; i++)
             System.out.println("Student " + i + " score is " + score[i] + " and grade is " + getGrade(score[i], best));
     }

     public static char getGrade(int score, int max)
     {
         if(score >= max - 10)
             return 'A';
         else if(score >= max - 20)
             return 'B';
         else if(score >= max - 30)
             return 'C';
         else if(score >= max - 40)
             return 'D';
         else
             return 'F';
     }
 }

HW6.1的更多相关文章

  1. HW6.30

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  2. HW6.29

    public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...

  3. HW6.28

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  4. HW6.27

    import java.util.Scanner; import java.util.Arrays; public class Solution { public static void main(S ...

  5. HW6.26

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  6. HW6.25

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  7. HW6.24

    public class Solution { public static void main(String[] args) { int count = 0; int color; int numbe ...

  8. HW6.23

    public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; f ...

  9. HW6.22

    import java.util.Arrays; public class Solution { public static void main(String[] args) { int[][] ch ...

  10. HW6.21

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

随机推荐

  1. php继承与重载

    <?php class A { public $param = "paramA"; public function test() { echo "testA&quo ...

  2. ArcGIS学习记录—KMZ KML与SHP文件互相转换

      1.在google earth中绘制边界  工具栏中选择"Add Polygon".随意绘制一个多边形.  右击添加的图层名(左侧)保存位置为,选择保存为kmz或kml文件.  ...

  3. classpath、path、JAVA_HOME的作用及JAVA环境变量配置

    CLASSPATH是什么?它的作用是什么? 它是javac编译器的一个环境变量.它的作用与import.package关键字有关.当你写下improt java.util.*时,编译器面对import ...

  4. POJ1850——Code(组合数学)

    Code DescriptionTransmitting and memorizing information is a task that requires different coding sys ...

  5. POJ3687——Labeling Balls(反向建图+拓扑排序)

    Labeling Balls DescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries ...

  6. 企业级 Linux 安全管理实例(1)

    公司企业多用Linux服务器,其中涉及到的一些安全管理对于安全运维人员来说是必不可少的应知技能, 以下案例沿着背景->需求->具体要求->操作步骤的流程进行描述,可以加深对安全管理的 ...

  7. bzoj1030

    AC自动机和DP. f[i][j] 表示在匹配到第i位置,处于ac自动机的j节点.决策第(i+1)个字母,计算出转移到第j2节点. f[i+1][j2] += f[i][j]; #include< ...

  8. c语言中 int *p = NULL 和 *p = NULL 有什么区别

    1. int *p = NULL; 代表定义一个指向整型变量的指针p,然后p的值设为NULL,也就是设为0:用另一种方式说,就是对一个刚定义的指向整型变量的指针,赋初始值,让其指向0地址. 2. *p ...

  9. java适配器模式

    原文查看:http://www.cnblogs.com/java-my-life/archive/2012/04/13/2442795.html

  10. MySQL join的实现原理及优化思路

    Join 的实现原理 在MySQL 中,只有一种Join 算法,也就是Nested Loop Join,没有其他很多数据库所提供的Hash Join,也没有Sort Merge Join.顾名思义,N ...