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. ural 1160

    最小生成树  第一次敲 套用几个函数 其实挺容易的 #include <cstdio> #include <cstring> #include <vector> # ...

  2. Firefly的角色跳转场景简单示例

    源地址:http://bbs.9miao.com/thread-45790-1-2.html 本例演示的是模拟游戏服务端,让角色在场景1中跳转到场景2中.在实际游戏中,client将要跳转的角色id和 ...

  3. hdu 4678 Mine 博弈论

    这是一题简单的博弈论!! 所有的空白+边界的数字(个数为n)为一堆,容易推出其SG函数值为n%2+1: 其他所有的数字(个数为m)的SG值为m%2. 再就是用dfs将空白部分搜一下即可!(注意细节) ...

  4. SaaS系列介绍之五: 我国SaaS市场分析

    1 我国SaaS市场现状 我国SaaS从ASP年代发展到今天,也有不少时间了.我国是个十几亿人的大国,国情复杂,各地贫富不均,发展不平衡.信息系统建设也是各树一帜,各地为王.特别是占有大量用户的中小企 ...

  5. javaweb学习总结(四十六)——Filter(过滤器)常见应用

    一.统一全站字符编码 通过配置参数charset指明使用何种字符编码,以处理Html Form请求参数的中文问题 1 package me.gacl.web.filter; 2 3 import ja ...

  6. SQLite入门与分析(三)---内核概述(1)

    写在前面:从本章开始,我们开始进入SQLite的内核.为了能更好的理解SQLite,我先从总的结构上讨论一下内核,从全局把握SQLite很重要.SQLite的内核实现不是很难,但是也不是很简单.总的来 ...

  7. Spring中的实例生成方式及其生命周期

    三种实例化bean的方式1.使用类构造器实例化 <!-- 使用类构造器实例化,class属性表示要使用的类的全限定名 --> <bean id="userDao1" ...

  8. UVA548——Tree(中后序建树+DFS)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  9. python脚本工具 - 4 获取系统当前时间

    #! /usr/bin/python import time current_time = time.strftime("%Y-%m-%d %H:%M") print curren ...

  10. android开发无障碍app

    最近做一些为盲人提供服务的APP,还是挺有感触的,感谢手机和互联网的普及,他们的生活比以前丰富了很多. 通过读屏软件,盲人可以操作手机,上网浏览信息.读屏软件的工作原理很简单,就是读出屏幕上按钮.文本 ...