真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java刪除學(xué)生成績代碼 java中刪除學(xué)生信息的代碼

java問題,我抱著萬分之一的希望來問下,程序如下,走一遍沒問題,加了while(true){……}之后就出現(xiàn)異常

給你改了下,你看能不能用。你用while語句還是要注意的while true是死循環(huán),你里面數(shù)組長度就是10.到了自然報錯,不然你改成3.4。5這種數(shù)試試。后面的刪除自己再寫吧,我就給你寫了添加

成都創(chuàng)新互聯(lián)是創(chuàng)新、創(chuàng)意、研發(fā)型一體的綜合型網(wǎng)站建設(shè)公司,自成立以來公司不斷探索創(chuàng)新,始終堅持為客戶提供滿意周到的服務(wù),在本地打下了良好的口碑,在過去的10年時間我們累計服務(wù)了上千家以及全國政企客戶,如成都人造霧等企業(yè)單位,完善的項目管理流程,嚴格把控項目進度與質(zhì)量監(jiān)控加上過硬的技術(shù)實力獲得客戶的一致稱揚。

stuMark?am=new?stuMark();

int?num=0;????

int?i=0;

Scanner?sn=new?Scanner(System.in);

System.out.print("請選擇你要執(zhí)行的操作:1.輸入并存儲學(xué)生成績?5.通過學(xué)號刪除學(xué)生成績");

num=sn.nextInt();

Scanner?sc=new?Scanner(System.in);

while(iam.index){

float?mark=0;

System.out.println("請輸入學(xué)號為"+i+"的學(xué)生的成績:");

mark=sc.nextFloat();

am.inMark(mark,i);

i++;

}

for?(float?d:am.arr)?{

System.out.println(d);

}

學(xué)生管理系統(tǒng)的刪除學(xué)生信息 刪除代碼請修改一下。。急需幫助。。馬上就要交作業(yè)了

import java.awt.event.*;

import javax.swing.*;

import java.awt.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

public class DeleteFrame extends JFrame implements ActionListener {

private MainFrame parentF;

JTextField jt1=new JTextField();

JTextField jt2=new JTextField();

JTextField JTextField_free=new JTextField();

JButton jb=new JButton("刪除");

JOptionPane JOptionPane1 = new JOptionPane();

public DeleteFrame(MainFrame m){

super("刪除學(xué)生信息 ");

parentF=m;

this.setSize( 400,250);

this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

Container c=this.getContentPane();

c.setLayout(null);

JLabel j1=new JLabel("學(xué) 號");

JLabel j2=new JLabel("姓 名");

c.add(j1);

j1.setBounds(10,10,60,30);

c.add(jt1);

jt1.setBounds(70,10,100,30);

c.add(j2);

j2.setBounds(200,10,60,30);

c.add(jt2);

jt2.setBounds(250,10,100,30);

c.add(jb);

jb.setBounds(100,180,60,40);

jb.addActionListener(this);

this.addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent e){

parentF.setVisible(true);

shutDown();

}

});

}

public void shutDown(){

this.dispose();

}

public void deleteRecord(int id){

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

}

catch(ClassNotFoundException ex){

System.exit(-1);

}

try{

String URL="jdbc:odbc:student1";

Connection con =DriverManager.getConnection(URL);

Statement stmt1=con.createStatement();

String SQL="delete from 成績表 where id = " + id;

ResultSet rs=stmt1.executeQuery(SQL);

System.out.println(stmt1);

stmt1.close();

con.close();

JTextField_free.setText("");

JOptionPane1.showMessageDialog(this,"刪除成功","消息",

JOptionPane.INFORMATION_MESSAGE);

}

catch(SQLException ex){

ex.printStackTrace();

}

}

public void actionPerformed(ActionEvent e){

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

this.deleteRecord(id);//id為所刪記錄的主鍵值

}

}

}

用java寫一個學(xué)生成績管理系統(tǒng)程序,且有增加,查詢,修改,刪除,要求在控制臺顯示

我這邊有個可視化編程的 當(dāng)初的上機實驗 可采納

import java.awt.*;

import java.awt.event.*;

public class Test extends Frame implements TextListener,ItemListener,ActionListener,WindowListener

{

static TextArea ta1=new TextArea(" ",10,1,TextArea.SCROLLBARS_NONE);

static TextArea ta2=new TextArea(" ",10,1,TextArea.SCROLLBARS_NONE);

static Checkbox chk_g1=new Checkbox("男");

static Checkbox chk_g2=new Checkbox("女");

static Checkbox g=new Checkbox();

static Choice cho1=new Choice();

static Choice cho2=new Choice();

static Button bun1=new Button("增加");

static Button bun2=new Button("刪除");

static List lst=new List();

static Test frm=new Test();

public static void main(String[] args)

{

Test frm=new Test();

CheckboxGroup grp=new CheckboxGroup();

frm.setLayout(null);

frm.setTitle("學(xué)生信息輸入窗口");

frm.setBounds(100,100,400,400);

lst.setBounds(10,50,180,300);

ta1.setBounds(210,50,180,20);

ta2.setBounds(210,100,180,20);

chk_g1.setBounds(210,150,80,40);

chk_g2.setBounds(300,150,80,40);

cho1.setBounds(210,200,180,40);

cho2.setBounds(210,250,180,40);

bun1.setBounds(210,300,80,40);

bun2.setBounds(300,300,80,40);

chk_g1.setCheckboxGroup(grp);

chk_g2.setCheckboxGroup(grp);

cho1.add("計算機科學(xué)與技術(shù)");

cho1.add("金融系");

cho2.add("金融理財");

cho2.add("軟件工程");

cho2.add("網(wǎng)絡(luò)技術(shù)");

frm.setBackground(Color.lightGray);

ta1.setBackground(Color.lightGray);

ta2.setBackground(Color.lightGray);

lst.setBackground(Color.lightGray);

chk_g1.setBackground(Color.lightGray);

chk_g2.setBackground(Color.lightGray);

cho1.setBackground(Color.lightGray);

cho2.setBackground(Color.lightGray);

bun1.setBackground(Color.lightGray);

bun2.setBackground(Color.lightGray);

frm.add(ta1);

frm.add(ta2);

frm.add(chk_g1);

frm.add(chk_g2);

frm.add(cho1);

frm.add(cho2);

frm.add(bun1);

frm.add(bun2);

frm.add(lst);

ta1.addTextListener(frm);

ta2.addTextListener(frm);

chk_g1.addItemListener(frm);

chk_g2.addItemListener(frm);

cho1.addItemListener(frm);

cho2.addItemListener(frm);

bun1.addActionListener(frm);

bun2.addActionListener(frm);

lst.addItemListener(frm);

frm.addWindowListener(frm);

frm.setVisible(true);

}

public void windowOpened(WindowEvent e){}

public void windowActivated(WindowEvent e){}

public void windowIconified(WindowEvent e){}

public void windowDeiconified(WindowEvent e){}

public void windowClosing(WindowEvent e)

{

frm.dispose();

System.exit(0);

}

public void windowDeactivated(WindowEvent e){}

public void windowClosed(WindowEvent e){}

public void textValueChanged(TextEvent e)

{

}

public void itemStateChanged(ItemEvent e)

{

}

public void actionPerformed(ActionEvent e)

{

Button but=(Button)e.getSource();

if(but==bun1)

{

String text1=ta1.getText();

String text2=ta2.getText();

String c1=cho1.getSelectedItem();

String c2=cho2.getSelectedItem();

if(chk_g1.getState())

{

lst.add(text1+" "+text2+" "+chk_g1.getLabel()+" "+c1+" "+c2);

}

else if(chk_g2.getState())

{

lst.add(text1+" "+text2+" "+chk_g2.getLabel()+" "+c1+" "+c2);

}

}

else if(but==bun2)

{

String B=lst.getSelectedItem();

lst.remove(B);

}

}

}

基于java設(shè)計一個學(xué)生成績管理系統(tǒng),要求有界面,且有增加,查詢,修改,刪除,退出功能,代碼如何寫?

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é)號:");

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("班級:");

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("計算機工程系");

tf5.setForeground(Color.blue);

tf5.setBackground(Color.white);

tf5.setSize(80, 20);

tf5.setLocation(200, 170);

final Label l6 = new Label("成績:");

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();

}

}

可以仿照我的做一下,希望采納,我才一級哦


當(dāng)前標題:java刪除學(xué)生成績代碼 java中刪除學(xué)生信息的代碼
轉(zhuǎn)載來于:http://weahome.cn/article/dopjjsi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部