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();

         int score = 0;
         int max = 0;
         String student = "";
         String maxStudent = "";

         for(int i = 0; i < numberOfStudents; i++)
         {
             System.out.print("Enter a student's name: ");
             student = input.next();

             System.out.print("Enter his score: ");
             score = input.nextInt();

             if(score > max)
             {
                 max = score;
                 maxStudent = student;
             }
         }

         input.close();

         System.out.println("The one has best score is " + maxStudent + ", his score is " + max);
     }
 }

HW4.8的更多相关文章

  1. HW4.46

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

  2. HW4.45

    public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ...

  3. HW4.44

    public class Solution { public static void main(String[] args) { double randX; double randY; int hit ...

  4. HW4.43

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

  5. HW4.42

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

  6. HW4.41

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

  7. HW4.40

    public class Solution { public static void main(String[] args) { long positiveSide = 0; long negativ ...

  8. HW4.39

    public class Solution { public static void main(String[] args) { double sum; double baseSalary = 500 ...

  9. HW4.38

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

  10. HW4.37

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

随机推荐

  1. Django视图函数

    一.视图函数 1. 视图函数的第一个参数一定是一个HTTPRequest类型的对象,这个对象是Django自动创建的,具体形参名通常用request.通过这个对象,可以调用请求的一些参数,比如requ ...

  2. HIVE中内连接和左半连接不一致问题

    一.理论 HIVE中都是按等值连接来统计的,理论上两种写法统计结果应该是一致的: 二.实际情况 但实际使用中发现两种写法会返回的结果,总会有一些差距虽然差别不大,但让人很是困惑. 三.原因 当使用jo ...

  3. To fix sql server 2008 r2 Evaluation period has expired by change the key

    PTTFM-X467G-P7RH2-3Q6CG-4DMYB 数据中心版:PTTFM-X467G-P7RH2-3Q6CG-4DMYB   测试可用 开 发者 版:MC46H-JQR3C-2JRHY-XY ...

  4. 敏捷开发的价值观(转自MBAlib)

    敏捷开发的价值观 实际上敏捷开发运动在数年前就开始了,但它正式开始的标志是2001年2月的“敏捷宣言”(Agile Manifesto),这项宣言是由17位当时称之为“轻量级方法学家”所编写签署的,他 ...

  5. 认识变量------JAVA

    声明变量: variables must have a type variables must have a name int count // type int //count name 变量就是杯 ...

  6. shell 流程控制

    for循环: #!/bin/bash for file in $(ls /ect) do echo $file done

  7. Git的一些基本概念

    Git的一些基本概念 设置自己的用户名和邮箱git config –global user.name "Your Name"git config –global user.emai ...

  8. ie6 css sprites重复加载

    如果你使用css sprites,那么在ie6下并不能发挥sprites的作用,它还是会每次再重新 加载这个图片,解决方法为为ie6添加下面这条js: <!--[if IE 6]>     ...

  9. c语言的自动类型转换

    转自c语言的自动类型转换 自动转换遵循以下规则: 1)        若参与运算量的类型不同,则先转换成同一类型,然后进行运算. 2)        转换按数据长度增加的方向进行,以保证精度不降低.如 ...

  10. Docker 监控- Prometheus VS Cloud Insight

    如今,越来越多的公司开始使用 Docker 了,2 / 3 的公司在尝试了 Docker 后最终使用了它.为了能够更精确的分配每个容器能使用的资源,我们想要实时获取容器运行时使用资源的情况,怎样对 D ...