所选用的编译工具为NetBeans

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jianpan2; /**
*
* @author Administrator
*/
public class KuangJia extends javax.swing.JFrame { /**
* Creates new form KuangJia
*/ // private final double INF = 0x7f7f7f7f;
private String str="";
private double num1=0,num2=0;
private int result=0; private int FuHao=0,Diansum=0; public KuangJia() {
initComponents();
} /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() { jButton0 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jButtonDIAN = new javax.swing.JButton();
jButtonDENG = new javax.swing.JButton();
jButtonJIA = new javax.swing.JButton();
jButtonJIAN = new javax.swing.JButton();
jButtonCHENG = new javax.swing.JButton();
jButtonCHU = new javax.swing.JButton();
jButtonC = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton9 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton0.setText("0");
jButton0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton0ActionPerformed(evt);
}
}); jTextField1.setEditable(false);
jTextField1.setFont(new java.awt.Font("宋体", 1, 24)); // NOI18N
jTextField1.setText("0");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
}); jButtonDIAN.setText(".");
jButtonDIAN.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonDIANActionPerformed(evt);
}
}); jButtonDENG.setText("=");
jButtonDENG.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonDENGActionPerformed(evt);
}
}); jButtonJIA.setText("+");
jButtonJIA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonJIAActionPerformed(evt);
}
}); jButtonJIAN.setText("-");
jButtonJIAN.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonJIANActionPerformed(evt);
}
}); jButtonCHENG.setText("*");
jButtonCHENG.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCHENGActionPerformed(evt);
}
}); jButtonCHU.setText("/");
jButtonCHU.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCHUActionPerformed(evt);
}
}); jButtonC.setText("C");
jButtonC.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCActionPerformed(evt);
}
}); jButton1.setText("1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
}); jButton2.setText("2");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
}); jButton3.setText("3");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
}); jButton4.setText("4");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
}); jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
}); jButton6.setText("6");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
}); jButton7.setText("7");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
}); jButton8.setText("8");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
}); jLabel1.setText("num1="); jButton9.setText("9");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
}); jLabel3.setText("num2="); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonC, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCHU, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCHENG, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonJIAN, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonJIA, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton0, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonDIAN, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonDENG, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField1))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonJIAN, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonCHENG, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonCHU, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonC, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButtonJIA, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton0, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonDIAN, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButtonDENG, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
); pack();
}// </editor-fold> private void jButton0ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton0.getText());
} private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
} private void jButtonDIANActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(Diansum==0){
shuzi(this.jButtonDIAN.getText());
Diansum++;
}
} private void jButtonDENGActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jisuan();
result=0;
} private void jButtonJIAActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: result++;
if(result>1)
jisuan();
else
gengxin();
FuHao=1;
} private void jButtonJIANActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: result++;
if(result>1)
jisuan();
else
gengxin();
FuHao=2;
} private void jButtonCHENGActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: result++;
if(result>1)
jisuan();
else
gengxin();
FuHao=3;
} private void jButtonCHUActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: result++;
if(result>1)
jisuan();
else
gengxin();
FuHao=4;
} private void jButtonCActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
result=0;
num1=0;
num2=0;
FuHao=0;
Diansum=0;
str="";
xianshi(str);
} private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton1.getText());
} private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton2.getText());
} private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton3.getText());
} private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton4.getText());
} private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton5.getText());
} private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton6.getText());
} private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton7.getText());
} private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton8.getText());
} private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
shuzi(this.jButton9.getText());
}
private void shuzi (String str)
{
this.str=this.str+str;
xianshi(this.str);
}
private void gengxin()
{
if("".equals(jTextField1.getText())){
num2=0;
}else
num2=Double.parseDouble(jTextField1.getText());
str="";
Diansum=0; xianshi(num2);
}
private void xianshi(String ch)
{
if(!"".equals(ch)){
this.jTextField1.setText(ch);
}
else this.jTextField1.setText("0");
}
private void xianshi(double num)
{
if(num-(int)num>0.0000001){
this.jTextField1.setText(Double.toString(num));
}else {
this.jTextField1.setText(Integer.toString((int)num));
} }
private void jisuan()
{ num1=num2; // num2=Double.parseDouble(str);
gengxin(); switch (FuHao) {
case 1:
num2=num1+num2;
break;
case 2:
num2=num1-num2;
break;
case 3:
num2=num1*num2;
break;
case 4:
if(num2>0.0000001){
num2=num1/num2;
}else {
xianshi("除数不能为0!");
return ;
}
break;
default: break;
}
xianshi(num2);
jLabel2.setText(Double.toString(num1));
jLabel4.setText(Double.toString(num2));
FuHao=0;
// result=0;
str="";
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(KuangJia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(KuangJia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(KuangJia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(KuangJia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold> /* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { new KuangJia().setVisible(true); }
});
} // Variables declaration - do not modify
private javax.swing.JButton jButton0;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JButton jButtonC;
private javax.swing.JButton jButtonCHENG;
private javax.swing.JButton jButtonCHU;
private javax.swing.JButton jButtonDENG;
private javax.swing.JButton jButtonDIAN;
private javax.swing.JButton jButtonJIA;
private javax.swing.JButton jButtonJIAN;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTextField1;
// End of variables declaration
}

java开发简易计算器的更多相关文章

  1. java使用window builder图形界面开发简易计算器

    界面效果: /** * */ package calculator; import java.awt.BorderLayout; import java.awt.EventQueue; import ...

  2. 微信小程序开发简易计算器改进版

    微信小程序开发计算器有多种方法,但是大部分代码比较复杂.不容易理解.本案例进行了改进,主要是组件bindtap属性绑定的自定义函数clickBtn(),采用了switch语句,使得代码结构更加清晰,学 ...

  3. Java实现简易计算器

    import java.util.Scanner; public class Demo_1 { public static void main(String[] args) { //输入的两个数字进行 ...

  4. java基础——简易计算器的实现

    计算器: import java.util.Scanner;​public class CalculateDemo {    public static void main(String[] args ...

  5. 基于java的简易计算器实现

    方法: 1.将string类型的表达式输入转换成后缀表达式 2.计算后缀表达式 步骤一:将string类型的表达式输入转换成后缀表达式 输入字符串表达式,并将表达式转换成char型数组 String ...

  6. 01.Java 开发简单的计算器

    难度为一般,适合具有 Java 基础和 Swing 组件编程知识的用户学习一. 实验介绍1.1 实验内容本次实验利用Java开发一个可以进行简单的四则运算的图形化计算器,会使用到 Java Swing ...

  7. 剖析简易计算器带你入门微信小程序开发

    写在前面,但是重点在后面 这是教程,也不是教程. 可以先看Demo的操作动图,看看是个什么玩意儿,GitHub地址(https://github.com/dunizb/wxapp-sCalc) 自从微 ...

  8. 《Java 程序设计》课堂实践项目-简易计算器

    <Java 程序设计>课堂实践项目简易计算器 课后学习总结 目录 改变 简易计算器实验要求 课堂实践成果 课后思考 改变 修改了博客整体布局,过去就贴个代码贴个图很草率,这次布局和内容都有 ...

  9. [java代码库]-简易计算器(第二种)

    [java代码库]-简易计算器(第二种) 第二种方案:在程序中不使用if/switch……case等语句,完成计算器功能. <html> <head> <title> ...

随机推荐

  1. python--calc计算器的小程序

    x写一个计算器的小程序,正在筹备中......钱不够,演员未定,剧本暂无,请稍等

  2. win10如何一键开启关闭windows Defender(亲测有效)

    win10如何一键开启关闭windows Defender(亲测有效) 一.总结 一句话总结:各种找资料如何开启关闭都没用,直接下载软件简单方便 软件 因为我关windows defender是用的一 ...

  3. python 断言大全

    参考链接:https://blog.csdn.net/qq1124794084/article/details/51668672 1. 小数位模糊等于 自动化脚本最重要的是断言,正确设置断言以后才能帮 ...

  4. Getting started with Processing 第六章总结

    平移,旋转和缩放 前言 在这一章节中,平移.旋转和缩放都是以原点为基准的.并且是通过控制坐标系原点的位置来达到图元平移,旋转.缩放的视觉效果.作者在文中的原话是:另一种在屏幕上改变位置和移动物体的技术 ...

  5. GRCh38基因组和注释文件探究

    ensembl/release91: cat Homo_sapiens.GRCh38.91.gtf | grep -v "#" | cut -f9 | cut -f1,3,6,8 ...

  6. English trip EM2-LP-1A Hi Teacher:Taylor

    课上内容(Lesson) 词汇(Key Word ) Introduce  vt. 介绍:引进:提出:采用 greet  [ɡrit]  vt. 欢迎,迎接:致敬,致意:映入眼帘  n. (Greet ...

  7. 4.1.4 Nim

    Problem description: 有n堆石子,每堆各有ai颗石子.A和B轮流从非空的石子堆中取走至少一颗石子.A先取,取光所有石子的一方获胜.当双方都采用最佳策略时,谁会获胜? 1<=n ...

  8. C/S和B/S 《JavaWeb开发王者归来》学习笔记

    RCP 桌面程序(Desktop Program)也叫胖客户端程序(Rich Client Program),需要安装到计算机上才能运行.例如:word,excel,QQ等. TCP 瘦客户端程序(T ...

  9. 巧用JSON

    在开发的过程中,对json的接触基本是前端页面搭建完成后,对后台数据的请求.如果接口尚未提供,一般情况下会先按规定的要求写好需要的json模拟出请求的后台数据.json的格式有很多种,关注的主体是da ...

  10. python迭代器概念与应用

    结论 )可迭代对象包含迭代器.2)如果一个对象拥有__iter__方法,其是可迭代对象:如果一个对象拥有next方法,其是迭代器.3)生成器是一种特殊的迭代器,生成器自动实现了“迭代器协议”(即__i ...