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;
         int secondMax = 0;
         String student = "";
         String maxStudent = "";
         String secondMaxStudent = "";

         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)
             {
                 secondMax = max;
                 secondMaxStudent = maxStudent;
                 max = score;
                 maxStudent = student;

             }
         }

         input.close();

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

HW4.9的更多相关文章

  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. CODEVS 3943 数学奇才琪露诺

    [题目描述 Description] 作为上白泽慧音老师的出色弟子,数学奇才琪露诺在算术方面有很深的造诣.今天,codevs有幸请到了这位数学界的奇葩作为本场考试的第一题主考官. 琪露诺喜欢0-9之间 ...

  2. js 转化类似这样的时间( /Date(1389060261000)/)问题

    首先在你的js文件里添加这段代码: /** * 日期时间格式化方法, * 可以格式化年.月.日.时.分.秒.周 **/ Date.prototype.Format = function (format ...

  3. 认识变量------JAVA

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

  4. sql 锁相关(转)

    锁是数据库中的一个非常重要的概念,它主要用于多用户环境下保证数据库完整性和一致性. 我们知道,多个用户能够同时操纵同一个数据库中的数据,会发生数据不一致现象.即如果没有锁定且多个用户同时访问一个数据库 ...

  5. 解决win8 plsql无法登录

    今天安装完oracle客户端,然后打开 plsql 之后,就一个提示框,提示没有登录,后来解决方法如下: 在plsql的图标上点右键,以管理员身份运行,即可! 如果不想一直点右键执行,就图标上点右键- ...

  6. 浅谈HTTP中Get与Post的区别/HTTP协议与HTML表单(再谈GET与POST的区别)

    HTTP协议与HTML表单(再谈GET与POST的区别) GET方式在request-line中传送数据:POST方式在request-line及request-body中均可以传送数据. http: ...

  7. java中path和classpath

    Path 路径,是java编译时需要调用的程序(如java,javac等)所在的地方; CLASSPATH的作用是指定查找类的路径:当使用java命令执行一个类(类中的main方法)时,会从class ...

  8. scp传入固件,sysupgrade xx.bin升级固件

    scp传入固件,sysupgrade xx.bin升级固件

  9. Codevs_1166_[NOIP2007]_矩阵取数游戏_(动态规划+高精度)

    描述 http://codevs.cn/problem/1166/ 分析 #include <iostream> #include <cstring> #include < ...

  10. -_-#【减少 DOM 访问】“离线”更新节点,再将它们添加到树中

    Minimize DOM Access javascript 之 DOM 优化 <!DOCTYPE html> <html> <head> <meta cha ...