内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

口算生成代碼java 口算自動(dòng)生成

java編寫一個(gè)小軟件用于測(cè)試小學(xué)生10以內(nèi)四則運(yùn)算的口算能力

我可以說一下思路:

站在用戶的角度思考問題,與客戶深入溝通,找到曲周網(wǎng)站設(shè)計(jì)與曲周網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、空間域名、網(wǎng)頁(yè)空間、企業(yè)郵箱。業(yè)務(wù)覆蓋曲周地區(qū)。

取到所有下拉框的值,還有這個(gè)輸入框的值,比如第一個(gè)是: num1 第二個(gè)是運(yùn)算符:* 第三個(gè)是:num2 第四個(gè)是結(jié)果: result

點(diǎn)擊提交,給一個(gè)點(diǎn)擊事件,把取到的值進(jìn)行運(yùn)算var cal= Integer.parseInt(num1)* Integer.parseInt(num2),cla是自己定義的,然后判斷程序計(jì)算的結(jié)果是否和輸入的結(jié)果相等,再給出相應(yīng)的提示

java代碼生成器怎么用

zip包,然后自動(dòng)下載下來

1.預(yù)先定義好模板

2.界面輸入相關(guān)參數(shù)

3.解析模板生成代碼并下載

最后放出源代碼:

package com.et.controller.system.createcode;

import java.util.ArrayList;

import java.util.Date;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import com.et.controller.base.BaseController;

import com.et.util.DelAllFile;

import com.et.util.FileDownload;

import com.et.util.FileZip;

import com.et.util.Freemarker;

import com.et.util.PageData;

import com.et.util.PathUtil;

/**

* 類名稱:FreemarkerController

* 創(chuàng)建人:Harries

* 創(chuàng)建時(shí)間:2015年1月12日

* @version

*/

@Controller

@RequestMapping(value=”/createCode”)

public class CreateCodeController extends BaseController {

/**

* 生成代碼

*/

@RequestMapping(value=”/proCode”)

public void proCode(HttpServletResponse response) throws Exception{

PageData pd = new PageData();

pd = this.getPageData();

/* ============================================================================================= */

String packageName = pd.getString(“packageName”); //包名 ========1

String objectName = pd.getString(“objectName”); //類名 ========2

String tabletop = pd.getString(“tabletop”); //表前綴 ========3

tabletop = null == tabletop?””:tabletop.toUpperCase(); //表前綴轉(zhuǎn)大寫

String zindext = pd.getString(“zindex”); //屬性總數(shù)

int zindex = 0;

if(null != zindext !””.equals(zindext)){

zindex = Integer.parseInt(zindext);

}

ListString[] fieldList = new ArrayListString[](); //屬性集合 ========4

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

fieldList.add(pd.getString(“field”+i).split(“,fh,”)); //屬性放到集合里面

}

MapString,Object root = new HashMapString,Object(); //創(chuàng)建數(shù)據(jù)模型

root.put(“fieldList”, fieldList);

root.put(“packageName”, packageName); //包名

root.put(“objectName”, objectName); //類名

root.put(“objectNameLower”, objectName.toLowerCase()); //類名(全小寫)

root.put(“objectNameUpper”, objectName.toUpperCase()); //類名(全大寫)

root.put(“tabletop”, tabletop); //表前綴

root.put(“nowDate”, new Date()); //當(dāng)前日期

DelAllFile.delFolder(PathUtil.getClasspath()+”admin/ftl”); //生成代碼前,先清空之前生成的代碼

/* ============================================================================================= */

String filePath = “admin/ftl/code/”; //存放路徑

String ftlPath = “createCode”; //ftl路徑

/*生成controller*/

Freemarker.printFile(“controllerTemplate.ftl”, root, “controller/”+packageName+”/”+objectName.toLowerCase()+”/”+objectName+”Controller.java”, filePath, ftlPath);

/*生成service*/

Freemarker.printFile(“serviceTemplate.ftl”, root, “service/”+packageName+”/”+objectName.toLowerCase()+”/”+objectName+”Service.java”, filePath, ftlPath);

/*生成mybatis xml*/

Freemarker.printFile(“mapperMysqlTemplate.ftl”, root, “mybatis_mysql/”+packageName+”/”+objectName+”Mapper.xml”, filePath, ftlPath);

Freemarker.printFile(“mapperOracleTemplate.ftl”, root, “mybatis_oracle/”+packageName+”/”+objectName+”Mapper.xml”, filePath, ftlPath);

/*生成SQL腳本*/

Freemarker.printFile(“mysql_SQL_Template.ftl”, root, “mysql數(shù)據(jù)庫(kù)腳本/”+tabletop+objectName.toUpperCase()+”.sql”, filePath, ftlPath);

Freemarker.printFile(“oracle_SQL_Template.ftl”, root, “oracle數(shù)據(jù)庫(kù)腳本/”+tabletop+objectName.toUpperCase()+”.sql”, filePath, ftlPath);

/*生成jsp頁(yè)面*/

Freemarker.printFile(“jsp_list_Template.ftl”, root, “jsp/”+packageName+”/”+objectName.toLowerCase()+”/”+objectName.toLowerCase()+”_list.jsp”, filePath, ftlPath);

Freemarker.printFile(“jsp_edit_Template.ftl”, root, “jsp/”+packageName+”/”+objectName.toLowerCase()+”/”+objectName.toLowerCase()+”_edit.jsp”, filePath, ftlPath);

/*生成說明文檔*/

Freemarker.printFile(“docTemplate.ftl”, root, “說明.doc”, filePath, ftlPath);

//this.print(“oracle_SQL_Template.ftl”, root); 控制臺(tái)打印

/*生成的全部代碼壓縮成zip文件*/

FileZip.zip(PathUtil.getClasspath()+”admin/ftl/code”, PathUtil.getClasspath()+”admin/ftl/code.zip”);

/*下載代碼*/

FileDownload.fileDownload(response, PathUtil.getClasspath()+”admin/ftl/code.zip”, “code.zip”);

}

}

用JAVA編寫一個(gè)程序 要求實(shí)現(xiàn)功能:隨機(jī)生成十道口算題

應(yīng)該有規(guī)定是多少范圍內(nèi)整數(shù)吧 還有就是加減乘除吧 隨機(jī)就用math.random()乘范圍出數(shù) 然后取整 加減乘數(shù)也用隨機(jī)數(shù)switch判斷1234分別是加減乘除 倒數(shù)用timer和timertask類實(shí)現(xiàn) 那個(gè)手機(jī)的得響應(yīng)一個(gè)向下獲取焦點(diǎn)事件 類似的onKeyReleaseDown吧 下一個(gè)組件.setFocus 提交就是onSubmit事件 處理action或直接跳到ftl或者jsp上處理 傳入結(jié)果參數(shù)程序分別判斷下正確個(gè)數(shù) 然后顯示就行了 正確率乘5就是分?jǐn)?shù)

用java編得計(jì)算器程序軟件和源代碼

java計(jì)算器源程序

java計(jì)算器

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

class calculation extends JFrame

{public calculation() /*構(gòu)造方法*/

{super("計(jì)數(shù)器");

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

initTextPanel(); /*文本框*/

initControlPanel(); /*控制鍵*/

initKeyPanel(); /*數(shù)字和運(yùn)算符*/

Container pane = getContentPane();

pane.setLayout(new BorderLayout());

pane.add(TextPanel,BorderLayout.NORTH);

pane.add(ControlPanel,BorderLayout.CENTER);

pane.add(KeyPanel,BorderLayout.SOUTH);

pack();

try

{UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

}

catch(Exception ex)

{;} /*設(shè)置Windons觀感*/

SwingUtilities.updateComponentTreeUI(this);

setResizable(false);

setVisible(true);

}

private void initTextPanel() /*設(shè)置文本框*/

{ TextPanel=new JPanel();

TextPanel.setLayout(new FlowLayout());

Resultarea =new JTextField("0",25);

Resultarea.setEditable(false); /*設(shè)置不可編輯*/

Color color=Color.white;

Resultarea.setBackground(color); /*顏色*/

Resultarea.setHorizontalAlignment(JTextField.RIGHT); /*設(shè)置顯示位置*/

TextPanel.add(Resultarea);

}

private void initControlPanel() /*設(shè)置控制鍵*/

{ControlPanel=new JPanel();

ControlPanel.setLayout(new GridLayout(1,3,4,4));

JButton b1=new JButton("Backspace"); /*Backspace鍵*/

b1.setFont(font1);

b1.addActionListener(new ActionListener()

{public void actionPerformed(ActionEvent e)

{String s1=Resultarea.getText();

int l=s1.length();

Resultarea.setText(s1.substring(0 ,l-1));

}

});

ControlPanel.add(b1);

JButton b2=new JButton("CE"); /*CE鍵*/

b2.setFont(font1);

b2.addActionListener(new ActionListener()

{public void actionPerformed(ActionEvent e)

{Resultarea.setText("0");

isNew=true;

}

});

ControlPanel.add(b2);

JButton b3=new JButton("C"); /*C鍵*/

b3.setFont(font1);

b3.addActionListener(new ActionListener()

{public void actionPerformed(ActionEvent e)

{Resultarea.setText("0");

pnum="";

operation="";

isNew=true;

}

});

ControlPanel.add(b3);

}

private void initKeyPanel() /*設(shè)置數(shù)字鍵和運(yùn)算符鍵*/

{String key[] = {"7","8","9","/","sqrt","4","5","6","*","%","1","2","3","-","1/x","0","+/-",".","+","="};

KeyPanel = new JPanel();

KeyPanel.setLayout(new GridLayout(4,5,4,4));

for(int i=0;i20;i++)

{String label = key[i];

JButton b = new JButton(label);

b.setActionCommand(key[i]);

b.setFont(font2);

KeyPanel.add(b);

b.addActionListener(new ActionListener() /*無(wú)名監(jiān)聽器*/

{public void actionPerformed(ActionEvent e)

{Key_actionPerformed(e);

}

});

}

}

public void Key_actionPerformed(ActionEvent e) /*數(shù)字鍵和運(yùn)算符鍵無(wú)名監(jiān)聽器*/

{String s=(e.getActionCommand());

String st=Resultarea.getText();

if(s.equals("0")) /*輸入數(shù)為0*/

{if(st.equals("0"))

return;

else

{if(!isNew)

Resultarea.setText(st+"0");

else

Resultarea.setText("0");

}

isNew=false;

return;

}

if(s.equals("+/-")) /*輸入數(shù)為+/-*/

{double k=Double.parseDouble(st);

{if(k!=0)

display(-k);

}

return;

}

if(s.equals("1")||s.equals("2")||s.equals("3")||s.equals("4")||s.equals("5")||s.equals("6")||s.equals("7")||s.equals("8")||s.equals("9")) /*輸入1-9*/

{if(!isNew)

Resultarea.setText(st+s);

else

{ Resultarea.setText(s);

isNew=false;

}

return;

}

if(s.equals(".")) /*輸入小數(shù)點(diǎn)*/

{if(Resultarea.getText().indexOf(".")==-1) /*不存在小數(shù)點(diǎn)*/

{if(isNew)

{Resultarea.setText("0.");

isNew=false;

}

else

Resultarea.setText(st+".");

}

return;

}

isNew=true; /*按下運(yùn)算符,輸入新的數(shù)*/

if(s.equals("="))

{compute(s);

operation="";

}

else

{if(s.equals("+")||s.equals("-")||s.equals("*")||s.equals("/")) /*二目運(yùn)算符號(hào)*/

{if(operation.equals(""))

{pnum=Resultarea.getText();

operation=s;

}

else

compute(s);

}

else /*一目運(yùn)算*/

{Count count1=new Count(Double.parseDouble(st));

if(s.equals("sqrt"))

{

display(count1.sqrt());

}

else

{if(s.equals("1/x"))

{if(st.equals("0"))

{Resultarea.setText("除數(shù)不能為0.");

operation="";

pnum="";

}

else

display(count1.reciprocal()); /*求倒數(shù)*/

}

else

display(Double.parseDouble(st)/100); /*輸入%,使當(dāng)前顯示的值除于100*/

}

}

}

}

private void compute(String s)

{if(s.equals("="))

{if(operation.equals(""))

return;

}

double data1=Double.parseDouble(pnum);

double data2=Double.parseDouble(Resultarea.getText());

Count count2=new Count(data1,data2); /*加減乘除計(jì)算*/

if(operation.equals("+"))

display((count2.plus()));

else

{if(operation.equals("-"))

display((count2.minus()));

else

{if(operation.equals("*"))

display((count2.multiply()));

else

if(operation.equals("/"))

{if(data2==0)

{Resultarea.setText("除數(shù)不能為0");

operation="";

pnum="";

return;

}

else

display((count2.divide()));

}

}

}

operation=""; /*符號(hào)為當(dāng)前符*/

pnum=Resultarea.getText();/*運(yùn)算數(shù)為當(dāng)前文本數(shù)*/

}

public void display(double result) /*顯示輸出方法*/

{int a=(int)result;

if(a==result)

Resultarea.setText(String.valueOf(a));

else

Resultarea.setText(String.valueOf(result));

if(Resultarea.getText().equals("NaN"))

Resultarea.setText("輸入函數(shù)無(wú)效");

}

private JPanel TextPanel; /*文本框棉板*/

private JTextField Resultarea; /*文本框*/

private JPanel ControlPanel; /*控制鍵鍵面板*/

private JPanel KeyPanel; /*數(shù)字鍵和運(yùn)算符鍵面板*/

private Font font1=new Font("Dialog",0, 10); /*控制鍵字體*/

private Font font2 = new Font("Dialog",0,10); /*數(shù)字鍵和符號(hào)鍵字體*/

private String pnum=""; /*前操作數(shù)*/

private boolean isNew=true; /*控制是否是新數(shù)*/

private String operation=""; /*運(yùn)算符*/

}

class tester /*測(cè)試類*/

{

public static void main(String[] args)

{

new calculation();

}

}

網(wǎng)站標(biāo)題:口算生成代碼java 口算自動(dòng)生成
文章鏈接:http://www.rwnh.cn/article6/hicpog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷型網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、服務(wù)器托管、全網(wǎng)營(yíng)銷推廣、網(wǎng)站維護(hù)、網(wǎng)站收錄

廣告

聲明:本網(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)

網(wǎng)站托管運(yùn)營(yíng)
青铜峡市| 张家口市| 临安市| 乐山市| 石狮市| 原平市| 蒙自县| 黄平县| 正镶白旗| 北票市| 赤峰市| 修文县| 朝阳县| 鸡泽县| 榆中县| 芒康县| 兴业县| 上饶县| 林西县| 通城县| 贞丰县| 息烽县| 长岛县| 普兰县| 新泰市| 同心县| 桂平市| 永仁县| 崇左市| 尚志市| 永康市| 剑阁县| 苍梧县| 镇原县| 隆昌县| 交口县| 古丈县| 镇坪县| 平安县| 银川市| 和林格尔县|