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 ...
随机推荐
- -webkit-text-size-adjust: none;该如何处理
-webkit-text-size-adjust: none; 在中文版Chrome里面,网页CSS里所有小于12px的字体设置都无效,最终将显示12px.这样弄的本意可能 是好的,因为中文一旦小于1 ...
- How to Cope with Deadlocks
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html How to Cope with Deadlocks This section ...
- Nagios : Verifying Your Configuration
Every time you modify your configuration files, you should run a sanity check on them. It is importa ...
- android dialog点击其他区域消失
只需调用dialog对象的setCanceledOnTouchOutside方法,传入参数为true即可. 如下代码实现: //点击其他区域dialog消失 menuDialog.setCancele ...
- SQLite入门与分析(四)---Page Cache之事务处理(3)
写在前面:由于内容较多,所以断续没有写完的内容. 11.删除日志文件(Deleting The Rollback Journal)一旦更改写入设备,日志文件将会被删除,这是事务真正提交的时刻.如果在这 ...
- 性能优化工具 MVC Mini Profiler
性能优化工具 MVC Mini Profiler MVC MiniProfiler是Stack Overflow团队设计的一款对ASP.NET MVC.WebForm 以及WCF 的性能分析的小程 ...
- 在XML里的XSD和DTD以及standalone的使用
有关XML结构中的XSD和DTD以及standalone的使用 XmlDeclaration declare= document.CreateXmlDeclaration("1.0" ...
- Android开发之xUtils-HttpUtils的使用
使用xUtils框架中的网络部分HttpUtils,功能:下载,断点续传,progressbar显示进度,文本显示进度% import java.io.File; import android.app ...
- CodeForces 135 B. Rectangle and Square(判断正方形和 矩形)
题目:http://codeforces.com/problemset/problem/135/B 题意:给8个点 判断能否用 4个点构成正方形,另外4个点构成 矩形. 输出 第一行是正方形 ,第二行 ...
- windows2003远程桌面退出后系统自动注销的解决方法
最近公司有一个奇怪的需求,意思是有一个网页,要时时的打开着.现在只有把这个网页在服务器上打开. 这样才能满足需求.但我在应用中遇见了个问题.我在服务器上打开网页后,关掉远程,过一会网页的运行效果就没有 ...