java刷分代碼 用java編寫一個(gè)刷題軟件

給段最簡單的java代碼 讓我新手看一下

最簡單的java代碼肯定就是這個(gè)了,如下:

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),潼南企業(yè)網(wǎng)站建設(shè),潼南品牌網(wǎng)站建設(shè),網(wǎng)站定制,潼南網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,潼南網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

public class MyFirstApp

{

public static void main(String[] args)

{

System.out.print("Hello world");

}

}

“hello world”就是應(yīng)該是所有學(xué)java的新手看的第一個(gè)代碼了。如果是零基礎(chǔ)的新手朋友們可以來我們的java實(shí)驗(yàn)班試聽,有免費(fèi)的試聽課程幫助學(xué)習(xí)java必備基礎(chǔ)知識,有助教老師為零基礎(chǔ)的人提供個(gè)人學(xué)習(xí)方案,學(xué)習(xí)完成后有考評團(tuán)進(jìn)行專業(yè)測試,幫助測評學(xué)員是否適合繼續(xù)學(xué)習(xí)java,15天內(nèi)免費(fèi)幫助來報(bào)名體驗(yàn)實(shí)驗(yàn)班的新手快速入門java,更好的學(xué)習(xí)java!

求用Java編寫的學(xué)生成績管理系統(tǒng)的完整代碼,要能運(yùn)行的

以下方法實(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("成績");//創(chuàng)建菜單“成績”

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)添加到“成績”菜單

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) //處理“查詢成績”事件

{

new ChengJiStudent();

}

}

public static void main(String args[])

{ new StudentJieMian(); //創(chuàng)建一個(gè)對象 }

求JAVA評委打分代碼

正好我閑著,給你寫一個(gè)吧。

我寫的這個(gè)評委分?jǐn)?shù)是在代碼里固定到數(shù)組里了,如果你需要運(yùn)行時(shí)手動輸入評分,可以將oldScores里的數(shù)據(jù)改成手動輸入就行了(這個(gè)不用我再寫了吧,如果不會再追問,再告訴你)。

你先新建一個(gè)類,將下面的main方法全部復(fù)制進(jìn)去就能運(yùn)行了,自己看一下吧。

/**?主方法?*/

public?static?void?main(String[]?args)

{

/**?保存原始評分的數(shù)組(如果你需要運(yùn)行時(shí)手動輸入分?jǐn)?shù),將?oldScores中的數(shù)據(jù)改成手動輸入就行了?*/

double[]?oldScores?=?{15,?77,?55,?88,?79,?98,?67,?89,?68,?88};

/**?最終將用來保存排序后的數(shù)組?*/

double[]?scores?=?new?double[oldScores.length];

double?temp;

/**?平均分?*/

double?avg?=?0;

int?k;

/**?將原始評分放入最終排序數(shù)組?*/

for?(int?i?=?0;?i??oldScores.length;?i++)

{

scores[i]?=?oldScores[i];

}

/**?開始排序?*/

for?(int?i?=?0;?i??scores.length?-?1;?i++)

{

k?=?i;

for?(int?j?=?i?+?1;?j??scores.length;?j++)

{

if?(scores[k]??scores[j])

{

k?=?j;

}

}

if?(i?!=?k)

{

temp?=?scores[k];

scores[k]?=?scores[i];

scores[i]?=?temp;

}

}

/**?計(jì)算去掉最高分和最低分之后的和?*/

double?sum?=?0;

/**?記錄計(jì)算平均分的分?jǐn)?shù)個(gè)數(shù)?*/

double?num?=?0;

for?(int?i?=?1;?i??scores.length?-?1;?i++)

{

num++;

sum?+=?scores[i];

}

/**?計(jì)算平均分?*/

avg?=?sum?/?num;

/**?最公平的肯定不是在scores數(shù)組兩端?*/

double?zgp?=?0;

double?cha?=?0;

/**?標(biāo)記與平均值差值最小的分?jǐn)?shù)位置?*/

int?flag?=?0;

/**?開始尋找最公平評分?*/

for?(int?i?=?1;?i??scores.length?-?1;?i++)

{

/**?為cha賦初始值,注意比較差值要使用絕對值比較?*/

if?(i?==?1)

{

cha?=?Math.abs(scores[i]?-?avg);

}

double?cha1?=?Math.abs(scores[i]?-?avg);

if?(cha1??cha)

{

cha?=?cha1;

flag?=?i;

}

}

zgp?=?scores[flag];

/**?由于最不公平的分?jǐn)?shù)肯定在scores數(shù)組的第一個(gè)或者是最后一個(gè)?*/

double?bgp?=?0;

if?(Math.abs(scores[0]?-?avg)??Math.abs(scores[scores.length?-?1]?-?avg))

{

bgp?=?scores[0];

}

else

{

bgp?=?scores[scores.length?-?1];

}

/**?全部計(jì)算完成,下面開始輸出結(jié)果?*/

System.out.println("原始評委分?jǐn)?shù)如下:");

for?(int?i?=?0;?i??oldScores.length;?i++)

{

System.out.print(oldScores[i]?+?",?");

}

System.out.println();

System.out.println("排序后分?jǐn)?shù)如下:");

for?(int?i?=?0;?i??scores.length;?i++)

{

System.out.print(scores[i]?+?",?");

}

System.out.println();

System.out.println("去掉最高分和最低分后平均分:"?+?avg);

System.out.println("最公平分?jǐn)?shù):"?+?zgp);

System.out.println("最不公平分?jǐn)?shù):"?+?bgp);

}

JAVA代碼

連連看java源代碼

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class lianliankan implements ActionListener

{

JFrame mainFrame; //主面板

Container thisContainer;

JPanel centerPanel,southPanel,northPanel; //子面板

JButton diamondsButton[][] = new JButton[6][5];//游戲按鈕數(shù)組

JButton exitButton,resetButton,newlyButton; //退出,重列,重新開始按鈕

JLabel fractionLable=new JLabel("0"); //分?jǐn)?shù)標(biāo)簽

JButton firstButton,secondButton; //分別記錄兩次被選中的按鈕

int grid[][] = new int[8][7];//儲存游戲按鈕位置

static boolean pressInformation=false; //判斷是否有按鈕被選中

int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戲按鈕的位置坐標(biāo)

int i,j,k,n;//消除方法控制

public void init(){

mainFrame=new JFrame("JKJ連連看");

thisContainer = mainFrame.getContentPane();

thisContainer.setLayout(new BorderLayout());

centerPanel=new JPanel();

southPanel=new JPanel();

northPanel=new JPanel();

thisContainer.add(centerPanel,"Center");

thisContainer.add(southPanel,"South");

thisContainer.add(northPanel,"North");

centerPanel.setLayout(new GridLayout(6,5));

for(int cols = 0;cols 6;cols++){

for(int rows = 0;rows 5;rows++ ){

diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1]));

diamondsButton[cols][rows].addActionListener(this);

centerPanel.add(diamondsButton[cols][rows]);

}

}

exitButton=new JButton("退出");

exitButton.addActionListener(this);

resetButton=new JButton("重列");

resetButton.addActionListener(this);

newlyButton=new JButton("再來一局");

newlyButton.addActionListener(this);

southPanel.add(exitButton);

southPanel.add(resetButton);

southPanel.add(newlyButton);

fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));

northPanel.add(fractionLable);

mainFrame.setBounds(280,100,500,450);

mainFrame.setVisible(true);

}

public void randomBuild() {

int randoms,cols,rows;

for(int twins=1;twins=15;twins++) {

randoms=(int)(Math.random()*25+1);

for(int alike=1;alike=2;alike++) {

cols=(int)(Math.random()*6+1);

rows=(int)(Math.random()*5+1);

while(grid[cols][rows]!=0) {

cols=(int)(Math.random()*6+1);

rows=(int)(Math.random()*5+1);

}

this.grid[cols][rows]=randoms;

}

}

}

public void fraction(){

fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));

}

public void reload() {

int save[] = new int[30];

int n=0,cols,rows;

int grid[][]= new int[8][7];

for(int i=0;i=6;i++) {

for(int j=0;j=5;j++) {

if(this.grid[i][j]!=0) {

save[n]=this.grid[i][j];

n++;

}

}

}

n=n-1;

this.grid=grid;

while(n=0) {

cols=(int)(Math.random()*6+1);

rows=(int)(Math.random()*5+1);

while(grid[cols][rows]!=0) {

cols=(int)(Math.random()*6+1);

rows=(int)(Math.random()*5+1);

}

this.grid[cols][rows]=save[n];

n--;

}

mainFrame.setVisible(false);

pressInformation=false; //這里一定要將按鈕點(diǎn)擊信息歸為初始

init();

for(int i = 0;i 6;i++){

for(int j = 0;j 5;j++ ){

if(grid[i+1][j+1]==0)

diamondsButton[i][j].setVisible(false);

}

}

}

public void estimateEven(int placeX,int placeY,JButton bz) {

if(pressInformation==false) {

x=placeX;

y=placeY;

secondMsg=grid[x][y];

secondButton=bz;

pressInformation=true;

}

else {

x0=x;

y0=y;

fristMsg=secondMsg;

firstButton=secondButton;

x=placeX;

y=placeY;

secondMsg=grid[x][y];

secondButton=bz;

if(fristMsg==secondMsg secondButton!=firstButton){

xiao();

}

}

}

public void xiao() { //相同的情況下能不能消去。仔細(xì)分析,不一條條注釋

if((x0==x (y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)(y0==y))){ //判斷是否相鄰

remove();

}

else{

for (j=0;j7;j++ ) {

if (grid[x0][j]==0){ //判斷第一個(gè)按鈕同行哪個(gè)按鈕為空

if (yj) { //如果第二個(gè)按鈕的Y坐標(biāo)大于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕左邊

for (i=y-1;i=j;i-- ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕

if (grid[x][i]!=0) {

k=0;

break;

}

else //K=1說明通過了第一次驗(yàn)證

}

if (k==1) {

linePassOne();

}

}

if (yj){ //如果第二個(gè)按鈕的Y坐標(biāo)小于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕右邊

for (i=y+1;i=j ;i++ ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕

if (grid[x][i]!=0){

k=0;

break;

}

else

}

if (k==1){

linePassOne();

}

}

if (y==j ) {

linePassOne();

}

}

if (k==2) {

if (x0==x) {

remove();

}

if (x0x) {

for (n=x0;n=x-1;n++ ) {

if (grid[n][j]!=0) {

k=0;

break;

}

if(grid[n][j]==0 n==x-1) {

remove();

}

}

}

if (x0x) {

for (n=x0;n=x+1 ;n-- ) {

if (grid[n][j]!=0) {

k=0;

break;

}

if(grid[n][j]==0 n==x+1) {

remove();

}

}

}

}

}

for (i=0;i8;i++ ) { //列

if (grid[i][y0]==0) {

if (xi) {

for (j=x-1;j=i ;j-- ) {

if (grid[j][y]!=0) {

k=0;

break;

}

else

}

if (k==1) {

rowPassOne();

}

}

if (xi) {

for (j=x+1;j=i;j++ ) {

if (grid[j][y]!=0) {

k=0;

break;

}

else

}

if (k==1) {

rowPassOne();

}

}

if (x==i) {

rowPassOne();

}

}

if (k==2){

if (y0==y) {

remove();

}

if (y0y) {

for (n=y0;n=y-1 ;n++ ) {

if (grid[i][n]!=0) {

k=0;

break;

}

if(grid[i][n]==0 n==y-1) {

remove();

}

}

}

if (y0y) {

for (n=y0;n=y+1 ;n--) {

if (grid[i][n]!=0) {

k=0;

break;

}

if(grid[i][n]==0 n==y+1) {

remove();

}

}

}

}

}

}

}

public void linePassOne(){

if (y0j){ //第一按鈕同行空按鈕在左邊

for (i=y0-1;i=j ;i-- ){ //判斷第一按鈕同左側(cè)空按鈕之間有沒按鈕

if (grid[x0][i]!=0) {

k=0;

break;

}

else //K=2說明通過了第二次驗(yàn)證

}

}

if (y0j){ //第一按鈕同行空按鈕在與第二按鈕之間

for (i=y0+1;i=j ;i++){

if (grid[x0][i]!=0) {

k=0;

break;

}

else

}

}

}

public void rowPassOne(){

if (x0i) {

for (j=x0-1;j=i ;j-- ) {

if (grid[j][y0]!=0) {

k=0;

break;

}

else

}

}

if (x0i) {

for (j=x0+1;j=i ;j++ ) {

if (grid[j][y0]!=0) {

k=0;

break;

}

else

}

}

}

public void remove(){

firstButton.setVisible(false);

secondButton.setVisible(false);

fraction();

pressInformation=false;

k=0;

grid[x0][y0]=0;

grid[x][y]=0;

}

public void actionPerformed(ActionEvent e) {

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

int grid[][] = new int[8][7];

this.grid = grid;

randomBuild();

mainFrame.setVisible(false);

pressInformation=false;

init();

}

if(e.getSource()==exitButton)

System.exit(0);

if(e.getSource()==resetButton)

reload();

for(int cols = 0;cols 6;cols++){

for(int rows = 0;rows 5;rows++ ){

if(e.getSource()==diamondsButton[cols][rows])

estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);

}

}

}

public static void main(String[] args) {

lianliankan llk = new lianliankan();

llk.randomBuild();

llk.init();

}

}

//old 998 lines

//new 318 lines

名稱欄目:java刷分代碼 用java編寫一個(gè)刷題軟件
轉(zhuǎn)載源于:http://www.muchs.cn/article26/dohsdjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、外貿(mào)網(wǎng)站建設(shè)品牌網(wǎng)站設(shè)計(jì)、App開發(fā)外貿(mào)建站、關(guān)鍵詞優(yōu)化

廣告

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

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司