资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java成绩查询方法代码 java成绩查询方法代码是什么

java软件做一个学生成绩查询系统

用易查分就可以做,把你需要查询的信息做成excel表格,上传到易查分,设置“学号”“姓名”为查询条件,设置完成后,点生成,就可以得到一个查询链接,你可以把这个链接放到你所说的网站上,学员点链接 输入学号姓名就能查到!另外如果信息有错误,你可以在易查分的后台,在线编辑,不用再次上传就能实现,非常简单的!

创新互联建站拥有网站维护技术和项目管理团队,建立的售前、实施和售后服务体系,为客户提供定制化的做网站、网站建设、网站维护、德阳电信服务器托管解决方案。为客户网站安全和日常运维提供整体管家式外包优质服务。我们的网站维护服务覆盖集团企业、上市公司、外企网站、商城网站定制开发、政府网站等各类型客户群体,为全球超过千家企业提供全方位网站维护、服务器维护解决方案。

用JAVA的switch来编一个程序实现成绩的查询,有些问题

先判 范围 再 case 搞一方法

private int check(int a)

{

if (a90)

return 1;

else if(90=a a=80)

return 2;

.........

}

switch(check(a)){

case 1:

System.out.println("成绩优秀");

.......

}

}

Java编程题,模拟成绩查询

import java.util.HashMap;

import java.util.LinkedList;

import java.util.Map;

import java.util.Scanner;

public class Test {

LinkedListHashMapString, Integer examList;

public Test() {

LinkedListHashMapString, Integer examList = new LinkedListHashMapString,Integer();

//第一次

HashMapString, Integer first = new HashMapString, Integer();

first.put("张三", 80);

first.put("李四", 65);

first.put("王五", 35);

first.put("薛六", 90);

first.put("赵七", 70);

//第二次

HashMapString, Integer second = new HashMapString, Integer();

second.put("张三", 88);

second.put("李四", 75);

second.put("王五", 45);

second.put("薛六", 92);

second.put("赵七", 75);

//第三次

HashMapString, Integer third = new HashMapString, Integer();

third.put("张三", 86);

third.put("李四", 67);

third.put("王五", 55);

third.put("薛六", 98);

third.put("赵七", 65);

//第四次

HashMapString, Integer fourth = new HashMapString, Integer();

fourth.put("张三", 88);

fourth.put("李四", 80);

fourth.put("王五", 59);

fourth.put("薛六", 88);

fourth.put("赵七", 68);

examList.add(first);

examList.add(second);

examList.add(third);

examList.add(fourth);

this.examList = examList;

}

//通过次数获得总成绩

public int getExamCount(int times) {

int count = 0;

HashMapString, Integer  exam = examList.get(times-1); 

for(String studentName :exam.keySet()) {

int score = exam.get(studentName);

count += score;

return count;

}

//通过学生姓名获得学生总成绩

public int getStudentExamCount(String name) {

int count = 0;

for(HashMapString, Integer  exam  : examList) {

int score = exam.get(name);

count += score;

}

return count;

}

//通过学生姓名获得学生的平局成绩

public int getStudentExamAvg(String name) {

int count = 0;

int times = 0;

for(HashMapString, Integer  exam  : examList) {

times++;

int score = exam.get(name);

count += score;

}

return count/times;

}

//查询全班平均分最高的一次

public MapInteger,Integer getClassMaxAvg() {

MapInteger,Integer result = new HashMapInteger,Integer();

int time = 0;//存储考试次数

int maxScoreAvg=0;//存储最高的考试成绩

int i = 0;//当前考试次数

for(HashMapString, Integer  exam  : examList) {

i++;

int scoreCount = 0;//存储考试成绩总和

for(String name : exam.keySet()) {

int score = exam.get(name);

scoreCount += score;

}

if((scoreCount/4) maxScoreAvg) {

time = i;

maxScoreAvg = scoreCount/4;

}

}

result.put(time, maxScoreAvg);

return result;

}

//通过学生姓名和考试次数获得学生的某次考试成绩

public int getStudentExam(String name,int times) {

MapString,Integer exam = examList.get(times-1);

int score = exam.get(name);

return score;

}

public void showTitle() {

System.out.println("==========成绩查询说明==========");

System.out.println("输入 1@[考试次数] 查询某次考试总成绩  如 1@2");

System.out.println("输入 2@[学生姓名] 查询某考生总成绩  如 2@李四");

System.out.println("输入 3@[学生姓名] 查询某考生平均成绩  如 3@李四");

System.out.println("输入 4 查询全班平均分最高的次数和成绩  如 4");

System.out.println("输入 5@[学生姓名]@[考试次数] 查询某考生某次成绩  如 5@张三@2");

System.out.println("==========成绩查询说明==========");

}

public static void main(String[] args) {

Test test = new Test();

test.showTitle();

Scanner s = new Scanner(System.in);

String input;

while(s.hasNext()) {

try {

input = s.next();

if(input.startsWith("1")) {

String[] inputs = input.split("@");

System.out.println("第"+inputs[1]+"次总成绩为:"+test.getExamCount(Integer.valueOf(inputs[1])));

}else if(input.startsWith("2")) {

String[] inputs = input.split("@");

System.out.println(inputs[1]+"的总成绩为:"+test.getStudentExamCount(inputs[1]));

}else if(input.startsWith("3")) {

String[] inputs = input.split("@");

System.out.println(inputs[1]+"平均成绩为:"+test.getStudentExamAvg(inputs[1]));

}else if(input.startsWith("4")) {

System.out.println("全班平均分最高的次数和成绩为:"+test.getClassMaxAvg());

}else if(input.startsWith("5")) {

String[] inputs = input.split("@");

System.out.println(inputs[1]+"第"+inputs[2]+"次考试成绩为:"+test.getStudentExam(inputs[1],Integer.valueOf(inputs[2])));

}else {

test.showTitle();

}

}catch(Exception e) {

test.showTitle();

}

}

}

}


文章题目:java成绩查询方法代码 java成绩查询方法代码是什么
文章源于:http://cdkjz.cn/article/ddsicpd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220