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. post请求json内容丢失问题

    今天在项目组用json传输数据 post方法提交 发现传输过去的数据json内的+ 号被直接干掉了. 后来传输之前直接先编码. 接收端: public void ProcessRequest(Http ...

  2. javascript 通用loading动画效果

    由于项目中多处要给ajax提交的时候增加等待动画效果,所以就写了一个简单的通用js方法: 代码如下: /*ajax提交的延时等待效果*/ var AjaxLoding = new Object(); ...

  3. windows store app search contract

    代码如下: html: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> ...

  4. Java练习题

    1.实现一个类似于ConcurrentHashMap的分段加锁 import java.util.HashMap; import java.util.Map; import java.util.con ...

  5. 解决Linux/aix 下的websphere log4j不生效

    websphere 解决Linux/aix下的log4j不生效 在目录: /IBM/WebSphere/AppServer/profiles/AppSrv01/properties 增加一个文件:可以 ...

  6. 静态分析安全测试(SAST)优缺点探析

    静态分析安全测试(SAST)是指不运行被测程序本身,仅通过分析或者检查源程序的语法.结构.过程.接口等来检查程序的正确性,那么采用静分析安全测试的方法有什么优缺点呢,且让小编给你说道说道. 许多公司都 ...

  7. [杂题]URAL1822. Hugo II's War

    看懂题意的请直接跳过下一坨! 本人有表达障碍! ========================================== 题意: (题意真的很难很难懂啊!!!  去他娘的**) 有一个王国 ...

  8. easyui源码翻译1.32--ValidateBox(验证框)

    前言 使用$.fn.validatebox.defaults重写默认值对象.下载该插件翻译源码 validatebox(验证框)的设计目的是为了验证输入的表单字段是否有效.如果用户输入了无效的值,它将 ...

  9. ANDROID_MARS学习笔记_S02_003_AutoCompleteTextView

    一. public class CountriesActivity extends Activity { protected void onCreate(Bundle icicle) { super. ...

  10. 解析rss和atom文件出现乱码问题

    try { String xmlString = new String(response.data, Charset.forName("UTF-8")); XmlPullParse ...