HW6.1

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的更多相关文章
- HW6.30
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.29
public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...
- HW6.28
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.27
import java.util.Scanner; import java.util.Arrays; public class Solution { public static void main(S ...
- HW6.26
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.25
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.24
public class Solution { public static void main(String[] args) { int count = 0; int color; int numbe ...
- HW6.23
public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; f ...
- HW6.22
import java.util.Arrays; public class Solution { public static void main(String[] args) { int[][] ch ...
- HW6.21
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
随机推荐
- spoj 247
不管行列 总是先切割切割费用大的 代码比较烂 ...... #include <iostream> #include <cstdio> #include <cstr ...
- Unity3D的几种坐标系
原地址:http://www.cnblogs.com/martianzone/p/3371789.html http://www.cnblogs.com/88999660/archive/2013/0 ...
- Side-by-side assembly
Side-by-side technology is a standard for executable files in Windows 98 Second Edition, Windows 200 ...
- [itint5]完全二叉树节点个数的统计
http://www.itint5.com/oj/#4 这题是利用完全二叉树的性质计算节点数目.那么是通过比较左右子树的最左结点的高度来看那边是满的,然后递归计算. //使用getLeftChildN ...
- Nginx、LVS及HAProxy负载均衡软件的优缺点详解
http://www.csdn.net/article/2014-07-24/2820837
- 关于fedora下jdk的安装
http://zhumeng8337797.blog.163.com/blog/static/1007689142012472620637/ alternative命令 http://blog.csd ...
- oracle时间加减的语句写法
FROM: http://soft.doit.com.cn/article/2012/0105/2850851.shtml --加法 --加1年 SELECT SYSDATE,ADD_MONTHS( ...
- pku,杨建武:文本挖掘技术
http://webkdd.org/course/ http://www.icst.pku.edu.cn/lcwm/course/WebDataMining/ http://www.icst.pku. ...
- entity framework 查询
1.简单查询: SQL: SELECT * FROM [Clients] WHERE Type=1 AND Deleted=0 ORDER BY ID EF: //Func形式 var clients ...
- 完全用xml实现imageview点击换一张图片
<ImageView android:layout_width="60dp" android:layout_height="60dp" android:b ...