用易查分就可以做,把你需要查詢的信息做成excel表格,上傳到易查分,設(shè)置“學(xué)號(hào)”“姓名”為查詢條件,設(shè)置完成后,點(diǎn)生成,就可以得到一個(gè)查詢鏈接,你可以把這個(gè)鏈接放到你所說的網(wǎng)站上,學(xué)員點(diǎn)鏈接 輸入學(xué)號(hào)姓名就能查到!另外如果信息有錯(cuò)誤,你可以在易查分的后臺(tái),在線編輯,不用再次上傳就能實(shí)現(xiàn),非常簡(jiǎn)單的!
10年積累的成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有大興免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.SQLException;
import javax.swing.JButton;
public class Stmessege {
Font font = new Font("楷體", Font.BOLD, 18);
private Frame m = new Frame("登陸成功界面");
protected Window f;
public Stmessege() {
m.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
m.setVisible(false);
m.dispose();
System.exit(0);
}
});
m.setSize(460, 360);
m.setBackground(Color.green);
m.setLayout(null);
m.setLocationRelativeTo(null);
Label l0 = new Label("管理員信息");
Font font1 = new Font("楷體", Font.BOLD, 32);
l0.setForeground(Color.blue);
l0.setSize(180, 50);
l0.setLocation(150, 30);
l0.setFont(font1);
final Label l1 = new Label("姓名:");
l1.setSize(60, 20);
l1.setLocation(10, 100);
l1.setFont(font);
TextField tf1 = new TextField("黃朋");
tf1.setForeground(Color.blue);
tf1.setBackground(Color.white);
tf1.setSize(50, 20);
tf1.setLocation(70, 100);
final Label l2 = new Label("學(xué)號(hào):");
l2.setSize(60, 20);
l2.setLocation(140, 100);
l2.setFont(font);
TextField tf2 = new TextField("111265");
tf2.setForeground(Color.blue);
tf2.setBackground(Color.white);
tf2.setSize(60, 20);
tf2.setLocation(190, 100);
final Label l3 = new Label("性別:");
l3.setSize(60, 20);
l3.setLocation(280, 100);
l3.setFont(font);
TextField tf3 = new TextField("男");
tf3.setForeground(Color.blue);
tf3.setBackground(Color.white);
tf3.setSize(40, 20);
tf3.setLocation(360, 100);
final Label l4 = new Label("班級(jí):");
l4.setSize(60, 20);
l4.setLocation(10, 170);
l4.setFont(font);
TextField tf4 = new TextField("611231");
tf4.setForeground(Color.blue);
tf4.setBackground(Color.white);
tf4.setSize(60, 20);
tf4.setLocation(67, 170);
final Label l5 = new Label("系別:");
l5.setSize(60, 20);
l5.setLocation(140, 170);
l5.setFont(font);
TextField tf5 = new TextField("計(jì)算機(jī)工程系");
tf5.setForeground(Color.blue);
tf5.setBackground(Color.white);
tf5.setSize(80, 20);
tf5.setLocation(200, 170);
final Label l6 = new Label("成績(jī):");
l6.setSize(60, 20);
l6.setLocation(280, 170);
l6.setFont(font);
TextField tf6 = new TextField("95");
tf6.setForeground(Color.blue);
tf6.setBackground(Color.white);
tf6.setSize(40, 20);
tf6.setLocation(360, 170);
final Label l7 = new Label("專業(yè):");
l7.setSize(60, 20);
l7.setLocation(10, 230);
l7.setFont(font);
TextField tf7 = new TextField("軟件技術(shù)");
tf7.setForeground(Color.blue);
tf7.setBackground(Color.white);
tf7.setSize(60, 20);
tf7.setLocation(70, 230);
JButton btn1 = new JButton("添加");
btn1.setForeground(Color.blue);
btn1.setSize(80, 38);
btn1.setLocation(35, 300);
btn1.setFont(font);
btn1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 插入();
m.setVisible(true);
}
});
JButton btn2 = new JButton("查詢學(xué)生學(xué)籍信息");
btn2.setForeground(Color.blue);
btn2.setSize(200, 38);
btn2.setLocation(135, 300);
btn2.setFont(font);
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Stmessege1 f;
try {
f = new Stmessege1();
f.Stmessege11();
m.setVisible(true);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
JButton btn3 = new JButton("刪除");
btn3.setForeground(Color.blue);
btn3.setSize(80, 38);
btn3.setLocation(350, 300);
btn3.setFont(font);
btn3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 刪除();
//f.setVisible(false);
m.setVisible(true);
}
});
JButton btn4 = new JButton("更新");
btn4.setForeground(Color.blue);
btn4.setSize(80, 38);
btn4.setLocation(200, 230);
btn4.setFont(font);
btn4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new 更新();
m.setVisible(true);
}
});
m.add(l0);
m.add(l1);
m.add(tf1);
m.add(l2);
m.add(tf2);
m.add(l3);
m.add(tf3);
m.add(l4);
m.add(tf4);
m.add(l5);
m.add(tf5);
m.add(l6);
m.add(tf6);
m.add(l7);
m.add(tf7);
m.add(btn1);
m.add(btn2);
m.add(btn3);
m.add(btn4);
m.setVisible(true);
}
public static void main(String[] args) {
new Stmessege();
}
}
可以仿照我的做一下,希望采納,我才一級(jí)哦
可使用jdbc鏈接。
下面是針對(duì)MySql的鏈接!
-----------------------------------------
package com.dgy.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class TestJDBC {
/**
* 1、所使用的mysql驅(qū)動(dòng)包為mysql-connector-java-5.0.8-bin.jar
* 2、Statement 用于執(zhí)行靜態(tài) SQL 語句并返回它所生成結(jié)果的對(duì)象
* 在默認(rèn)情況下,同一時(shí)間每個(gè) Statement 對(duì)象在只能打開一個(gè) ResultSet 對(duì)象。
* 因此,如果讀取一個(gè) ResultSet 對(duì)象與讀取另一個(gè)交叉,
* 則這兩個(gè)對(duì)象必須是由不同的Statement 對(duì)象生成的。
* 如果存在某個(gè)語句的打開的當(dāng)前 ResultSet 對(duì)象,
* 則Statement 接口中的所有執(zhí)行方法都會(huì)隱式關(guān)閉它。
* 3、ResultSet 表示數(shù)據(jù)庫結(jié)果集的數(shù)據(jù)表,通常通過執(zhí)行查詢數(shù)據(jù)庫的語句生成。
* ResultSet 對(duì)象具有指向其當(dāng)前數(shù)據(jù)行的指針。最初,指針被置于第一行之前。
* next 方法將指針移動(dòng)到下一行;
* 因?yàn)樵摲椒ㄔ?ResultSet 對(duì)象中沒有下一行時(shí)返回 false,
* 所以可以在 while 循環(huán)中 使用它來迭代結(jié)果集。
**/
static Connection conn = null;
public static Connection getConnectionByJDBC() {
try {
//裝載驅(qū)動(dòng)包類
Class.forName(com.mysql.jdbc.Driver");//加載驅(qū)動(dòng)
}catch(ClassNotFoundException e) {
System.out.println("裝載驅(qū)動(dòng)包出現(xiàn)異常!請(qǐng)查正!");
e.printStackTrace();
}
try{
/** 建立jdbc連接,但要注意此方法的第一個(gè)參數(shù),
* 如果127.0.0.1出現(xiàn)CommunicationsException異常,
* 可能就需要改為localhost才可以
**/
//jdbc:mysql://localhost:3306/test,test是數(shù)據(jù)庫
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
}catch(SQLException e) {
System.out.println("鏈接數(shù)據(jù)庫發(fā)生異常!");
e.printStackTrace();
}
return conn;
}
public static void test(){
String sql = "select * from user";
getConnectionByJDBC();
try{
//創(chuàng)建一個(gè)jdbc聲明
Statement stmt = conn.createStatement();
//執(zhí)行查詢
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
String username = rs.getString("username");
String password= rs.getString("password");
System.out.println(username +""+ password);
}
}catch (SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
}finally{
//預(yù)防性關(guān)閉連接(避免異常發(fā)生時(shí)在try語句塊關(guān)閉連接沒有執(zhí)行)
try{
if(conn != null) conn.close();
} catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
public static void main(String[] args){
TestJDBC testjdbc = new TestJDBC();
testjdbc.test();
}
}
import?java.util.Scanner;
public?class?Test?{
protected?static?boolean?end_flag?=?true;
public?static?void?main(String[]?args)?{
Students?student?=?new?Students();
student.InputData();//?輸入學(xué)生數(shù)據(jù)
String?order;
while?(end_flag)?{
System.out.println("請(qǐng)輸入數(shù)字1-5:");
Scanner?s?=?new?Scanner(System.in);
order?=?s.nextLine();
student.Operator(order);
}
}
}
Students類:
import?java.util.ArrayList;
import?java.util.Scanner;
public?class?Students?{
private?int?STUDENTS_NUM?=?5;?//?學(xué)生的人數(shù)
private?int?SUBJECTS_NUM?=?3;?//?課程數(shù)
private?String[][]?data?=?new?String[STUDENTS_NUM][SUBJECTS_NUM?+?2];
private?String?name;
private?int?Chinese_score;
private?int?Math_score;
private?int?English_score;
public?void?SearchHighestScore(String[][]?original)?{?//?查找最高成績(jī)
int?flag?=?Integer.parseInt(original[0][4]),?position?=?0;
for?(int?i?=?1;?i??original.length;?i++)?{
if?(Integer.parseInt(original[i][4])??flag)?{
flag?=?Integer.parseInt(original[i][4]);
position?=?i;
}
}
System.out.print("最高分同學(xué)的姓名和總分為:");
System.out.println(original[position][0]?+?"?"?+?original[position][4]);
}
public?void?SearchLowestScore(String[][]?original)?{
int?flag?=?Integer.parseInt(original[0][4]),?position?=?0;
for?(int?i?=?1;?i??original.length;?i++)?{
if?(Integer.parseInt(original[i][4])??flag)?{
flag?=?Integer.parseInt(original[i][4]);
position?=?i;
}
}
System.out.print("最低分同學(xué)的姓名和總分為:");
System.out.println(original[position][0]?+?"?"?+?original[position][4]);
}
public?void?OrderStudents(String[][]?original)?{
String[][]?result?=?original;
String?temp;
for?(int?i?=?1;?i??result.length;?i++)?{
for?(int?j?=?0;?j??result.length?-?i;?j++)?{
if?(Integer.parseInt(result[j][4])??Integer
.parseInt(result[j?+?1][4]))?{
temp?=?result[j][4];
result[j][4]?=?result[j?+?1][4];
result[j?+?1][4]?=?temp;
temp?=?result[j][0];
result[j][0]?=?result[j?+?1][0];
result[j?+?1][0]?=?temp;
}
}
}
System.out.println("排名\t"?+?"姓名\t"?+?"總分\t");
for?(int?i?=?0;?i??STUDENTS_NUM;?i++)?{
System.out.println(i?+?1?+?"\t"?+?result[i][0]?+?"\t"
+?result[i][4]);
}
}
public?void?ScoreUnder60(String[][]?original)?{
System.out.println("平均分在60以下的學(xué)生的姓名為:");
ArrayList?temp?=?new?ArrayList();
for?(int?i?=?0;?i??original.length;?i++)?{
if?(Integer.parseInt(original[i][4])?/?SUBJECTS_NUM??60)?{
temp.add(original[i][0]);
}
}
System.out.print(temp?+?"?");
System.out.println("\n"?+?"平均分在60以下的學(xué)生的人數(shù)為:"
+?temp.size());
}
public?Integer?SearchScore(String?student_name)?{
int?position?=?-1;
for?(int?i?=?0;?i??data.length;?i++)?{
if?(student_name.equals(data[i][0]))?{
position?=?i;
}
}
if?(position?!=?-1)
return?Integer.valueOf(data[position][4]);
else
return?null;
}
public?void?Operator(String?order)?{
if?("1".equals(order))?{
SearchHighestScore(data);
SearchLowestScore(data);
}?else?if?("2".equals(order))?{
OrderStudents(data);
}?else?if?("3".equals(order))?{
ScoreUnder60(data);
}?else?if?("4".equals(order))?{
String?name;
System.out.println("請(qǐng)輸入學(xué)生的姓名:");
Scanner?s?=?new?Scanner(System.in);
name?=?s.nextLine();
if?(SearchScore(name)?!=?null)
System.out.println(name?+?"的總分為:"?+?SearchScore(name));
else
System.out.println("查無此人");
}?else?if?("5".equals(order))?{
Test?obj?=?new?Test();
obj.end_flag?=?false;
System.out.println("退出");
}?else?{
System.out.println("輸入有誤!");
}
}
public?void?InputData()?{
for?(int?i?=?1;?i?=?STUDENTS_NUM;?i++)?{
System.out.print("請(qǐng)輸入第"?+?i?+?"個(gè)人的姓名"?+?":");
Scanner?s1?=?new?Scanner(System.in);
name?=?s1.nextLine();
data[i?-?1][0]?=?name;
System.out.print("請(qǐng)輸入第"?+?i?+?"個(gè)人的語文成績(jī)"?+?":");
Scanner?s2?=?new?Scanner(System.in);
Chinese_score?=?s2.nextInt();
data[i?-?1][1]?=?String.valueOf(Chinese_score);
System.out.print("請(qǐng)輸入第"?+?i?+?"個(gè)人的數(shù)學(xué)成績(jī)"?+?":");
Scanner?s3?=?new?Scanner(System.in);
Math_score?=?s3.nextInt();
data[i?-?1][2]?=?String.valueOf(Math_score);
System.out.print("請(qǐng)輸入第"?+?i?+?"個(gè)人的英語成績(jī)"?+?":");
Scanner?s4?=?new?Scanner(System.in);
English_score?=?s4.nextInt();
data[i?-?1][3]?=?String.valueOf(English_score);
data[i?-?1][4]?=?String.valueOf(Chinese_score?+?Math_score
+?English_score);
System.out.println(data[i?-?1][4]);
}
}
}
先判 范圍 再 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("成績(jī)優(yōu)秀");
.......
}
}
以下方法實(shí)現(xiàn)了用戶界面登陸
import java.awt.*;
import java.awt.event.*;
public class DengLuJieMian extends Frame implements ActionListener
{
Label username=new Label("用戶名:");//使用文本創(chuàng)建一個(gè)用戶名標(biāo)簽
TextField t1=new TextField();//創(chuàng)建一個(gè)文本框?qū)ο?/p>
Label password=new Label("密碼:");//創(chuàng)建一個(gè)密碼標(biāo)簽
TextField t2=new TextField();
Button b1=new Button("登陸");//創(chuàng)建登陸按鈕
Button b2=new Button("取消");//創(chuàng)建取消按鈕
public DengLuJieMian()
{
this.setTitle("學(xué)生信息管理系統(tǒng)");//設(shè)置窗口標(biāo)題
this.setLayout(null);//設(shè)置窗口布局管理器
username.setBounds(50,40,60,20);//設(shè)置姓名標(biāo)簽的初始位置
this.add(username);// 將姓名標(biāo)簽組件添加到容器
t1.setBounds(120,40,80,20);// 設(shè)置文本框的初始位置
this.add(t1);// 將文本框組件添加到容器
password.setBounds(50,100,60,20);//密碼標(biāo)簽的初始位置
this.add(password);//將密碼標(biāo)簽組件添加到容器
t2.setBounds(120,100,80,20);//設(shè)置密碼標(biāo)簽的初始位置
this.add(t2);//將密碼標(biāo)簽組件添加到容器
b1.setBounds(50,150,60,20);//設(shè)置登陸按鈕的初始位置
this.add(b1);//將登陸按鈕組件添加到容器
b2.setBounds(120,150,60,20);//設(shè)置取消按鈕的初始位置
this.add(b2);// 將取消按鈕組件添加到容器
b1.addActionListener(this);//給登陸按鈕添加監(jiān)聽器
b2.addActionListener(this);// 給取消按鈕添加監(jiān)聽器
this.setVisible(true);//設(shè)置窗口的可見性
this.setSize(300,200);//設(shè)置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});//通過內(nèi)部類重寫關(guān)閉窗體的方法
}
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[])//主函數(shù)
{
new DengLuJieMian();
}
}
以下方法實(shí)現(xiàn)了學(xué)生界面設(shè)計(jì)
import java.awt.*;
import java.awt.event.*;
class StudentJieMian extends Frame implements ActionListener
{
MenuBar m=new MenuBar();//創(chuàng)建菜單欄
Menu m1=new Menu("信息");//創(chuàng)建菜單“信息”
MenuItem m11=new MenuItem("插入");//創(chuàng)建“插入”的菜單項(xiàng)
MenuItem m12=new MenuItem("查詢");
Menu m2=new Menu("成績(jī)");//創(chuàng)建菜單“成績(jī)”
MenuItem m21=new MenuItem("查詢");
public StudentJieMian()
{
this.setTitle("學(xué)生界面");//設(shè)置窗口標(biāo)題
this.setLayout(new CardLayout());//設(shè)置窗口布局管理器
this.setMenuBar(m);//將菜單欄組件添加到容器
m.add(m1);//將信息菜單放入菜單欄
m.add(m2);
m1.add(m11);//將“插入”菜單項(xiàng)添加到“信息”菜單
m1.add(m12); //將“查詢”菜單項(xiàng)添加到“信息”菜單
m2.add(m21); //將“查詢”菜單項(xiàng)添加到“成績(jī)”菜單
m11.addActionListener(this); //給“插入”菜單項(xiàng)添加監(jiān)聽器
m12.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器
m21.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器
this.setVisible(true); //設(shè)置窗口的可見性
this.setSize(300,200); //設(shè)置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);//關(guān)閉窗口
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==m11) //處理“添加信息”事件
{
new AddStudent();
}
if(e.getSource()==m12) //處理“查詢信息”事件
{
new SelectStudent();
}
if(e.getSource()==m21) //處理“查詢成績(jī)”事件
{
new ChengJiStudent();
}
}
public static void main(String args[])
{ new StudentJieMian(); //創(chuàng)建一個(gè)對(duì)象 }
本文題目:java成績(jī)查詢代碼,java簡(jiǎn)單學(xué)生成績(jī)查詢系統(tǒng)
本文鏈接:http://chinadenli.net/article2/heshoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)站改版、網(wǎng)站導(dǎo)航、虛擬主機(jī)、App開發(fā)、營(yíng)銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)