135-1821-9792

Java学校系统代码 java学生系统管理

用Java 实现一个简单的学生管理系统! 求代码,求代码!!!!

完成了,希望能帮到你

成都创新互联公司专业为企业提供北海街道网站建设、北海街道做网站、北海街道网站设计、北海街道网站制作等企业网站建设、网页设计与制作、北海街道企业网站模板建站服务,10年北海街道做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

刚开始会叫你输入编号选择功能

import java.io.*;

public class student {

public static void main(String args[]) throws IOException{

int[] stud = {77,99,55,46,82,75,65,31,74,85};

System.out.println("请选择功能:");//输入编号选择功能

System.out.println("1、输入学号,查询该学生成绩:");

System.out.println("2、输入成绩,查询学生学号:");

System.out.println("3、输入学号,删除该学生成绩");

System.out.println("请选择编号:");

BufferedReader td = new BufferedReader(new InputStreamReader(System.in));

String temp = td.readLine();

int choice = Integer.valueOf(temp);

if(choice == 1){//一为查询学生成绩

System.out.println("请输入学号:");

BufferedReader sd = new BufferedReader(new InputStreamReader(System.in));

String temp_sd = sd.readLine();

int No = Integer.valueOf(temp_sd);

System.out.print("学号为 "+No+" 的学生成绩为: " + stud[No-1] +"分");

}

if(choice == 2){//二为查询学生编号

System.out.println("请输入成绩:");

BufferedReader sd = new BufferedReader(new InputStreamReader(System.in));

String chengji = sd.readLine();

int temp_cj = Integer.valueOf(chengji);

for(int i=0;istud.length;i++){

if(temp_cj == stud[i]){

System.out.print("成绩为 "+ temp_cj+ "的学生的学号为: "+(i+1));

}

}

}

if(choice == 3){//三为删除操作

System.out.println("请输入学号:");

BufferedReader sd = new BufferedReader(new InputStreamReader(System.in));

String temp_sd = sd.readLine();

int No = Integer.valueOf(temp_sd);

stud[No-1]=0;//直接赋值为0,不删除学生

System.out.print("学号为 "+No+" 的学生成绩为: " + stud[No-1] +"分");

}

}

}

JAVA 学生管理系统 求符合下列要求的代码

抽象层Student类-----然后派生出三个继承类,分别是三种学生,每个学生都有各自的字段,公共字段(学号,姓名)放入抽象父类。

方法很简单。写写就行了。

急求java学生信息管理系统源代码,带有连接数据库的,万分感谢

import java.awt.BorderLayout;

import java.awt.CardLayout;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.Icon;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javax.swing.JPanel;

import javax.swing.JToolBar;

import javax.swing.SwingConstants;

public class MainFrame extends JFrame implements ActionListener{

InsertPanel ip = null;

SelectPanel sp = null;

JPanel pframe;

JButton jb1,jb2,jb3;

JMenuItem jm11,jm21,jm22,jm23,jm31,jm32,jm41,jm42;

CardLayout clayout;

public MainFrame(String s){

super(s);

JMenuBar mb = new JMenuBar();

this.setJMenuBar(mb);

JMenu m1 = new JMenu("系统");

JMenu m2 = new JMenu("基本信息");

JMenu m3 = new JMenu("成绩");

JMenu m4 = new JMenu("奖惩");

mb.add(m1);

mb.add(m2);

mb.add(m3);

mb.add(m4);

jm11 = new JMenuItem("退出系统");

jm21 = new JMenuItem("输入");

jm22 = new JMenuItem("查询");

jm23 = new JMenuItem("更改");

jm31 = new JMenuItem("输入成绩");

jm32 = new JMenuItem("查询成绩");

jm41 = new JMenuItem("奖励");

jm42 = new JMenuItem("处分");

m1.add(jm11);

m2.add(jm21);

m2.add(jm22);

m2.add(jm23);

m3.add(jm31);

m3.add(jm32);

m4.add(jm41);

m4.add(jm42);

Icon i1 = new ImageIcon();

Icon i2 = new ImageIcon();

Icon i3 = new ImageIcon();

jb1 = new JButton(i1);

jb1.setToolTipText("输入");

jb2 = new JButton(i2);

jb2.setToolTipText("查询");

jb3 = new JButton(i3);

jb3.setToolTipText("退出");

JToolBar tb = new JToolBar("系统工具");

tb.add(jb1);

tb.add(jb2);

tb.add(jb3);

add(tb,BorderLayout.NORTH);

jm11.addActionListener(this);

jm21.addActionListener(this);

jm22.addActionListener(this);

jb1.addActionListener(this);

jb2.addActionListener(this);

jb3.addActionListener(this);

clayout = new CardLayout();

pframe = new JPanel(clayout);

add(pframe);

JPanel mainp = new JPanel(new BorderLayout());

JLabel mainl = new JLabel("学生信息管理平台",SwingConstants.CENTER);

mainl.setFont(new Font("serif",Font.BOLD,30));

mainp.add(mainl);

pframe.add(mainp,"main");

clayout.show(pframe, "main");

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jm21 || e.getSource() == jb1){

if(ip == null){

ip= new InsertPanel();

pframe.add(ip,"insert");

}

clayout.show(pframe, "insert");

this.setTitle("输入学生信息");

}

else if(e.getSource() == jm22 || e.getSource() == jb2){

if(sp == null){

sp= new SelectPanel();

pframe.add(sp,"select");

}

clayout.show(pframe, "select");

this.setTitle("查询学生信息");

}

else if(e.getSource() == jm11 || e.getSource() == jb3){

System.exit(0);

}

}

}

第二个:

import javax.swing.JFrame;

public class MainTest {

public static void main(String [] args){

MainFrame f = new MainFrame("学生信息管理平台");

f.setSize(400,300);

f.setLocation(350,250);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

}

第二个:

import java.sql.Connection;

import java.sql.DriverManager;

public class MySQLConnection {

static Connection getCon(){

Connection con = null;

try{

Class.forName("com.mysql.jdbc.Driver");

con = DriverManager.getConnection("jdbc:mysql://localhost/test","root","123");

}

catch(Exception e){

System.out.println("建立数据库连接遇到异常!");

}

return con;

}

}

第四个:

import java.awt.BorderLayout;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JTextField;

import javax.swing.SwingConstants;

public class SelectPanel extends JPanel implements ActionListener{

JButton jb;

JTextField jt;

JTextField jt1,jt2,jt3,jt4;

public SelectPanel(){

JLabel jl = new JLabel("请输入学号:",SwingConstants.CENTER);

jt = new JTextField();

jb = new JButton("确定");

JPanel jp1 = new JPanel(new GridLayout(1,3));

jp1.add(jl);

jp1.add(jt);

jp1.add(jb);

JLabel j1,j2,j3,j4;

j1 = new JLabel("学号:",SwingConstants.CENTER);

j2 = new JLabel("姓名:",SwingConstants.CENTER);

j3 = new JLabel("性别:",SwingConstants.CENTER);

j4 = new JLabel("年龄:",SwingConstants.CENTER);

jt1 = new JTextField(6);

jt1.setEditable(false);

jt2 = new JTextField(6);

jt2.setEditable(false);

jt3 = new JTextField(6);

jt3.setEditable(false);

jt4 = new JTextField(6);

jt4.setEditable(false);

JPanel jp2 = new JPanel(new BorderLayout());

JPanel jp3 = new JPanel(new GridLayout(4,2));

jp2.add(new JLabel(""),BorderLayout.NORTH);

jp3.add(j1);

jp3.add(jt1);

jp3.add(j2);

jp3.add(jt2);

jp3.add(j3);

jp3.add(jt3);

jp3.add(j4);

jp3.add(jt4);

jp2.add(jp3);

this.setLayout(new BorderLayout());

add(jp1,BorderLayout.NORTH);

add(jp2);

jb.addActionListener(this);

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jb){

String stuNo = jt.getText().trim();

Student s = new Student();

boolean b = true;

try{

b = s.selectByStuNo(stuNo);

}

catch(Exception ex){

System.out.println("查询学生信息遇到异常!");

}

if(b){

jt1.setText(s.getStuNo());

jt2.setText(s.getName());

jt3.setText(s.getGender());

int a = s.getAge();

Integer i = new Integer(a);

jt4.setText(i.toString());

}

else{

JOptionPane.showMessageDialog(null, "无此学生!");

}

}

}

}

第五个:

import javax.swing.JFrame;

public class SelectTest {

public static void main(String [] args){

JFrame f = new JFrame("查询学生信息");

SelectPanel p = new SelectPanel();

f.add(p);

f.setSize(400,300);

f.setLocation(300,250);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

}

第六个:

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.Statement;

public class Student {

String stuNo;

String name;

String gender;

int age;

public Student(){}

public Student(String stuNo,String name,String gender, int age){

this.stuNo = stuNo;

this.name = name;

this.gender = gender;

this.age = age;

}

public String getStuNo(){

return stuNo;

}

public void setStuNo(String stuNo){

this.stuNo = stuNo;

}

public String getName(){

return name;

}

public void setName(String name){

this.name = name;

}

public String getGender(){

return gender;

}

public void setGender(String gender){

this.gender = gender;

}

public int getAge(){

return age;

}

public void setAge(int age){

this.age = age;

}

public boolean insertStudent(){

boolean b = true;

try{

Connection con = MySQLConnection.getCon();

Statement statement = con.createStatement();

String sql = "insert into student values('" + stuNo + "','" + name +"','" + gender + "'," + age + ")";

sql = new String(sql.getBytes("gb2312"),"ISO8859_1");

statement.executeUpdate(sql);

con.close();

}

catch(Exception e){

b = false;

System.out.println("插入数据库遇到异常!");

}

return b;

}

public boolean selectByStuNo(String stuNo)throws Exception{

boolean b = true;

Connection con = MySQLConnection.getCon();

Statement statement = con.createStatement();

String sql = "select * from student where stuNo =" + stuNo;

ResultSet rs = statement.executeQuery(sql);

if(rs != null rs.next()){

String no = rs.getString(1);

this.setStuNo(no);

String n = rs.getString(2);

n = new String(n.getBytes("ISO8859_1"),"gb2312");

this.setName(n);

String g = rs.getString(3);

g = new String (g.getBytes("ISO8859_1"),"gb2312");

this.setGender(g);

this.setAge(rs.getInt(4));

b = true;

}

rs.close();

statement.close();

con.close();

return b;

}

}

数据库你自己弄吧,我没时间弄了!初学得多动手哦

求用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(); //创建一个对象 }


分享文章:Java学校系统代码 java学生系统管理
当前地址:http://kswsj.com/article/ddejsdg.html

其他资讯



Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号