
正文
java成绩查询方法代码 java编写成绩查询
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
java软件做一个学生成绩查询系统
用易查分就可以做,把你需要查询的信息做成excel表格,上传到易查分,设置“学号”“姓名”为查询条件,设置完成后,点生成,就可以得到一个查询链接,你可以把这个链接放到你所说的网站上,学员点链接 输入学号姓名就能查到!另外如果信息有错误,你可以在易查分的后台,在线编辑,不用再次上传就能实现,非常简单的!
相关问答
Q1: 求用Java编写的学生成绩管理系统的完整代码,要能运行的
以下方法实现了用户界面登陆
import java.awt.*;
import java.awt.event.*;
public class DengLuJieMian extends Frame implements ActionListener
{
Label username=new Label("用户名:");//使用文本创建一个用户名标签
TextField t1=new TextField();//创建一个文本框对象
Label password=new Label("密码:");//创建一个密码标签
TextField t2=new TextField();
Button b1=new Button("登陆");//创建登陆按钮
Button b2=new Button("取消");//创建取消按钮
public DengLuJieMian()
{
this.setTitle("学生信息管理系统");//设置窗口标题
this.setLayout(null);//设置窗口布局管理器
username.setBounds(50,40,60,20);//设置姓名标签的初始位置
this.add(username);// 将姓名标签组件添加到容器
t1.setBounds(120,40,80,20);// 设置文本框的初始位置
this.add(t1);// 将文本框组件添加到容器
password.setBounds(50,100,60,20);//密码标签的初始位置
this.add(password);//将密码标签组件添加到容器
t2.setBounds(120,100,80,20);//设置密码标签的初始位置
this.add(t2);//将密码标签组件添加到容器
b1.setBounds(50,150,60,20);//设置登陆按钮的初始位置
this.add(b1);//将登陆按钮组件添加到容器
b2.setBounds(120,150,60,20);//设置取消按钮的初始位置
this.add(b2);// 将取消按钮组件添加到容器
b1.addActionListener(this);//给登陆按钮添加监听器
b2.addActionListener(this);// 给取消按钮添加监听器
this.setVisible(true);//设置窗口的可见性
this.setSize(300,200);//设置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});//通过内部类重写关闭窗体的方法
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)//处理登陆事件
{
String name=t1.getText();
String pass=t2.getText();
if(name!=nullpass.equals("000123"))//判断语句
{
new StudentJieMian();
}
}
}
public static void main(String args[])//主函数
{
new DengLuJieMian();
}
}
以下方法实现了学生界面设计
import java.awt.*;
import java.awt.event.*;
class StudentJieMian extends Frame implements ActionListener
{
MenuBar m=new MenuBar();//创建菜单栏
Menu m1=new Menu("信息");//创建菜单“信息”
MenuItem m11=new MenuItem("插入");//创建“插入”的菜单项
MenuItem m12=new MenuItem("查询");
Menu m2=new Menu("成绩");//创建菜单“成绩”
MenuItem m21=new MenuItem("查询");
public StudentJieMian()
{
this.setTitle("学生界面");//设置窗口标题
this.setLayout(new CardLayout());//设置窗口布局管理器
this.setMenuBar(m);//将菜单栏组件添加到容器
m.add(m1);//将信息菜单放入菜单栏
m.add(m2);
m1.add(m11);//将“插入”菜单项添加到“信息”菜单
m1.add(m12); //将“查询”菜单项添加到“信息”菜单
m2.add(m21); //将“查询”菜单项添加到“成绩”菜单
m11.addActionListener(this); //给“插入”菜单项添加监听器
m12.addActionListener(this); //给“查询”菜单项添加监听器
m21.addActionListener(this); //给“查询”菜单项添加监听器
this.setVisible(true); //设置窗口的可见性
this.setSize(300,200); //设置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);//关闭窗口
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==m11) //处理“添加信息”事件
{
new AddStudent();
}
if(e.getSource()==m12) //处理“查询信息”事件
{
new SelectStudent();
}
if(e.getSource()==m21) //处理“查询成绩”事件
{
new ChengJiStudent();
}
}
public static void main(String args[])
{ new StudentJieMian(); //创建一个对象 }
Q2: 简单的Java程序,实现学生的数学,语文成绩的录入排序和查询。
java成绩查询方法代码我刚写的java成绩查询方法代码,可能还有点漏洞
import java.util.*;
import java.util.Scanner;
public class Bd05 {
public static final Scanner s = new Scanner(System.in);
public static void main(String[] args) {
ArrayListStudent al = new ArrayListStudent();
home(al);
}
public static void home(ListStudent list){
while(true){
System.out.println("1.录入学生信息 2.查询学生信息 3.删除学生信息 4.退出\n输入数字选择:");
int num = s.nextInt();
switch(num){
case 1:
inputInfo(list);
break;
case 2:
findInfo(list);
break;
case 3:
remove(list);
break;
case 4:
System.exit(0);
}
}
}
public static void findInfo(ListStudent list){ //查询信息
System.out.println("1.升序 2.降序 3.返回\n输入数字选择查询方式(两科的总分):");
int num = 0;
while(true){
num = s.nextInt();
if(num==1){ //升序
Collections.sort(list,new ComparatorStudent(){
public int compare(Student s1, Student s2) {
int n = new Integer(s1.getChinese()+s1.getMath()).compareTo(new Integer(s2.getChinese()+s2.getMath()));
if(n==0)
return s1.getName().compareTo(s2.getName());
return n;
}
});
printAll(list);
}
else if(num==2){ //降序
Collections.sort(list,new ComparatorStudent(){
public int compare(Student s1, Student s2) {
int n = new Integer(s2.getChinese()+s2.getMath()).compareTo(new Integer(s1.getChinese()+s1.getMath()));
if(n==0)
return s2.getName().compareTo(s1.getName());
return n;
}
});
printAll(list);
}
else if(num==3)
break;
else
System.out.println("输入错误,重新输入:");
}
home(list);
}
public static void remove(ListStudent list){ //删除信息
System.out.print("输入需要删除的姓名:");
String name = s.next();
IteratorStudent it = list.listIterator();
while(it.hasNext()){
Student str = it.next();
if(name.equals(str.getName())){
it.remove();
System.out.println(name+" 删除成功java成绩查询方法代码!");
}
}
System.out.println("1.继续 2.返回\n输入数字选择:");
while(true){
int num = s.nextInt();
if(num==1){
remove(list);
}
else if(num==2)
break;
else
System.out.println("输入错误,重新输入:");
}
home(list);
}
public static void printAll(ListStudent list){
int num = 1;
System.out.println("--------------(查询)----------------");
for(Student stu:list){
System.out.println(num++ +".姓名:"+stu.getName()+"|语文成绩:"+stu.getChinese()+"|数学成绩:"+stu.getMath()+"---|总分:"+(stu.getChinese()+stu.getMath()));
}
System.out.println("-----------------------------------");
home(list);
}
public static void inputInfo(ListStudent list){ //输入信息
System.out.println("输入学生姓名:");
String name = s.next();
System.out.println("输入数学成绩:");
int Math = s.nextInt();
System.out.println("输入语文成绩:");
int chinese = s.nextInt();
list.add(new Student(name,Math,chinese));
System.out.println("1.返回 2.继续录入\n输入数字选择:");
while(true){
int num = s.nextInt();
if(num==1)
break;
else if(num==2)
inputInfo(list);
else
System.out.println("输入错误,重新输入:");
}
home(list);
}
}
class Student{
private String name;
private int chinese;
private int math;
Student(String name,int math,int chinese){
this.name = name;
this.chinese = chinese;
this.math = math;
}
public String getName(){
return name;
}
public int getChinese(){
return chinese;
}
public int getMath(){
return math;
}
}
Q3: 用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("成绩优秀");
.......
}
}
Q4: 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;
}
//通过学生姓名获得学生java成绩查询方法代码的平局成绩
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]+"次考试成绩为java成绩查询方法代码:"+test.getStudentExam(inputs[1],Integer.valueOf(inputs[2])));
}else {
test.showTitle();
}
}catch(Exception e) {
test.showTitle();
}
}
}
}
关于java成绩查询方法代码和java编写成绩查询的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。






