免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

大二java課程設計代碼 大二java課程設計實驗報告

《Java》期末課程設計

import java.io.BufferedReader;

成都創(chuàng)新互聯(lián)主要從事網(wǎng)站建設、成都網(wǎng)站設計、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務峨山縣,10余年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:18980820575

import java.io.InputStreamReader;

public class QuestionOne {

/**

* 編程將從鍵盤輸入文本中的子字符串“word”替換為字符串“world”, 并刪除所有的子字符串“this”。

* 序程要求:程序中要包含有注釋,對于使用的變量和方法的功能要加以說明。

*/

public static void main(String[] args) {

BufferedReader reader = new BufferedReader(new InputStreamReader(

System.in));

String message = null; // 存儲用戶輸入的字符串

try {

while ((message = reader.readLine()) != null) {

// 打印處理前的字符串

System.out.println("輸入的字符串為:" + message);

// 把 word 替換為 world

message = message.replaceAll("word", "world");

// 把 this 替換為 空

message = message.replaceAll("this", "");

// 打印處理后的字符串

System.out.println("處理后為:" + message);

}

} catch (Exception e) {

e.printStackTrace();

System.out.println("出現(xiàn)異常,程序退出!");

}

}

}

跪求一個JAVA課程設計 學生信息管理系統(tǒng),含有全源代碼及設計報告的,有做好的給發(fā)一個,感激不盡!

可以試試看啊

以下方法實現(xiàn)了用戶界面登陸

import java.awt.*;

import java.awt.event.*;

public class DengLuJieMian extends Frame implements ActionListener

{

Label username=new Label("用戶名:");//使用文本創(chuàng)建一個用戶名標簽

TextField t1=new TextField();//創(chuàng)建一個文本框對象

Label password=new Label("密碼:");//創(chuàng)建一個密碼標簽

TextField t2=new TextField();

Button b1=new Button("登陸");//創(chuàng)建登陸按鈕

Button b2=new Button("取消");//創(chuàng)建取消按鈕

public DengLuJieMian()

{

this.setTitle("學生信息管理系統(tǒng)");//設置窗口標題

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);//給登陸按鈕添加監(jiān)聽器

b2.addActionListener(this);// 給取消按鈕添加監(jiān)聽器

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[])//主函數(shù)

{

new DengLuJieMian();

}

}

以下方法實現(xiàn)了學生界面設計

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)建“插入”的菜單項

MenuItem m12=new MenuItem("查詢");

Menu m2=new Menu("成績");//創(chuàng)建菜單“成績”

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); //給“插入”菜單項添加監(jiān)聽器

m12.addActionListener(this); //給“查詢”菜單項添加監(jiān)聽器

m21.addActionListener(this); //給“查詢”菜單項添加監(jiān)聽器

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[])

java課程設計源代碼(急!!!!)

import java.awt.Color;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.SwingConstants;

import javax.swing.border.LineBorder;

public class game21 extends JFrame {

private JLabel label_2;

private int number;

private int sum;

final JLabel label = new JLabel();

final JLabel label_1 = new JLabel();

public static void main(String[] args) {

new game21();

}

public game21() {

super("21點?!");

getContentPane().setLayout(null);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JButton button = new JButton();

button.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg0) {

onClick();

}

});

button.setText("出牌");

button.setBounds(170, 350, 106, 28);

getContentPane().add(button);

label.setBorder(new LineBorder(Color.black, 1, false));

label.setHorizontalAlignment(SwingConstants.CENTER);

label.setFont(new Font("", Font.BOLD, 26));

label.setText("背面");

label.setBounds(158, 81, 137, 153);

getContentPane().add(label);

label_1.setText("你已經(jīng)擁有的牌:");

label_1.setBounds(109, 22, 270, 45);

getContentPane().add(label_1);

this.setBounds(200, 300, 501, 528);

this.setVisible(true);

getContentPane().add(getLabel_2());

}

public int randNumber() {

try {

Thread.sleep(10);

} catch (InterruptedException e) {

e.printStackTrace();

}

return (int) (Math.random() * 10 + 1);

}

public void onClick() {

number = this.randNumber();

this.sum += number;

label.setText("" + number);

String strTemp = this.label_1.getText();

strTemp += "" + number + " ";

label_1.setText(strTemp);

String temp = "合計:" + sum;

label_2.setText(temp);

isWin();

}

public void isWin() {

if (sum 21) {

JOptionPane.showMessageDialog(this, "你輸了");

clear();

return;

} else if (sum == 21) {

JOptionPane.showMessageDialog(this, "你贏了");

clear();

return;

} else {

int i = JOptionPane.showOptionDialog(this, "是否繼續(xù)?", "提示",

JOptionPane.OK_CANCEL_OPTION,

JOptionPane.INFORMATION_MESSAGE, null, null, null);

if (i == JOptionPane.OK_OPTION) {

onClick();

} else

return;

}

}

private void clear() {

label_2.setText("合計:");

sum = 0;

number = 0;

label_1.setText("你已經(jīng)擁有的牌:");

}

/**

* @return

*/

protected JLabel getLabel_2() {

if (label_2 == null) {

label_2 = new JLabel();

label_2.setText("合計:");

label_2.setBounds(313, 35, 66, 18);

}

return label_2;

}

}

真好無聊中。。

網(wǎng)頁題目:大二java課程設計代碼 大二java課程設計實驗報告
轉載注明:http://m.newbst.com/article18/dogpigp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設定制網(wǎng)站品牌網(wǎng)站制作用戶體驗企業(yè)網(wǎng)站制作域名注冊

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設