HW4.9
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的更多相关文章
- HW4.46
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW4.45
public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ...
- HW4.44
public class Solution { public static void main(String[] args) { double randX; double randY; int hit ...
- HW4.43
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW4.42
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW4.41
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW4.40
public class Solution { public static void main(String[] args) { long positiveSide = 0; long negativ ...
- HW4.39
public class Solution { public static void main(String[] args) { double sum; double baseSalary = 500 ...
- HW4.38
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW4.37
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
随机推荐
- 使用openxml读取xml数据
xml的数据格式如下: <?xml version="1.0"?> <Language Name="Chinese"> <Loca ...
- oracle忘记用户密码
在cmd命令行下输入sqlplus / as sysdba alter user system identified by abc; 就可以将system用户的密码改成abc了. alter user ...
- poj 3013 Big Christmas Tree Djistra
Big Christmas Tree 题意:图中每个节点和边都有权值,图中找出一颗树,树根为1使得 Σ(树中的节点到树根的距离)*(以该节点为子树的所有节点的权值之和) 结果最小: 分析:直接求出每个 ...
- OFBiz之SVN下载地址
trunk: $ svn co http://svn.apache.org/repos/asf/ofbiz/trunk ofbiz release13.07: $ svn co http://svn. ...
- C# Windows Service调用IBM Lotus Notes发送邮件
近日研究了下IBM Lotus Mail,这货果然是麻烦,由于公司策略,没有开放smtp,很多系统邮件都没有办法发送,于是入手google学习Lotus Mail,想做成Windows服务,提供wcf ...
- noj [1479] How many (01背包||DP||DFS)
http://ac.nbutoj.com/Problem/view.xhtml?id=1479 [1479] How many 时间限制: 1000 ms 内存限制: 65535 K 问题描述 The ...
- shell脚本中>/dev/null的含义
shell脚本中>/dev/null的含义 shell脚本中有段使用sqlplus的部分: sqlplus ${user_id} <<! >/dev/null spool sp ...
- NUTCH Exception in thread "Thread-12751" java.lang.OutOfMemoryError: PermGen space
转载自 :http://greemranqq.iteye.com/blog/1705867转载自:http://www.cnblogs.com/xwdreamer/archive/2011/11/21 ...
- 带节假日JS万年历控件代码
<form name="CLD" class="content"> <table width="100%" border= ...
- BZOJ 1596: [Usaco2008 Jan]电话网络
Description Farmer John决定为他的所有奶牛都配备手机,以此鼓励她们互相交流.不过,为此FJ必须在奶牛们居住的N(1 <= N <= 10,000)块草地中选一些建上无 ...