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 ...
随机推荐
- 手工、工具分别实现cookie注入
最开始的判断access类型的网站注入点可以用“1 and 1=1”来判断. 不过现在的网站基本上被挡住了.之后呢,可以考虑cookie注入. Dim Tc_Post,Tc_Get,Tc_In,Tc_ ...
- uva 125
floyd 算法 如果存在无数条路 则存在a->a的路 a->b的路径数等于 a->i 和 i->b(0=<i<=_max) 路径数的乘积和 #includ ...
- 【leetcode】Dungeon Game (middle)
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...
- 跟随屏幕滚动层、遮罩层、获取Div相对定位、整个屏幕、html文档的jquery基本操作
一.层跟随屏幕滚动 <div style="width:120px;height:120px;border:1px solid red; position:absolute; left ...
- 如何在Ubuntu下启动Apache的Rewrite功能
在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块. 另外,也可以通过将 /etc/apache2/mods-available/rewrite.l ...
- 创业公司Playcafe关门大吉 创始人总结10大失败教训
导读:互联网电视游戏网站PlayCafe的创始人马克·高登森(Mark Goldenson)日前撰文,总结了自己创业失败的十个教训.以下为文章主要内容: 一年半前,我与公司联合创始人戴维·奈格(Dev ...
- Android:仿微信开场切换界面
这实例很多人仿做,好实例还是不容错过!最重要是素材容易拿~ 效果: 默认3页面的切换,最后一个页面带按钮,点击进入另外一个页面 思路: 1.准备5个布局页面,1个为主函数布局页面,3个为切换的页面(其 ...
- QPushButton 的checkable 属性
只有setCheckable(true),这个button才能发射 toggle(bool) 信号. 而toggle(bool)代表了button 按下,弹起的状态像0,1的切换开关.
- POJ2635——The Embarrassed Cryptographer(高精度取模+筛选取素数)
The Embarrassed Cryptographer DescriptionThe young and very promising cryptographer Odd Even has imp ...
- 区分jquery中的offset和position
一次又一次地碰到需要获取元素位置的问题, 然后一次又一次地查offset和position的区别. 忍不了了, 这次一定得想办法记下来. position是元素相对于父元素的位置. 这个好记, par ...