⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wincalculator.java

📁 本“计算器”可以完成任意的通常借助手持计算器来完成的标准运算。“计算器”可用于基本的算术运算
💻 JAVA
字号:
///////    WinCalculator.java    ///////

public class WinCalculator extends Calculator
{  
   public WinCalculator(MemoryEng e, WinFace f)
   {   super(e,f);
       setFormat(e.precision());
       width = f.getWidth();
   }

   protected WinCalculator() {}

   protected void output()
   {   String e = eng.status();
       if ( e.indexOf('E') != -1 )   // error
           return;
       double n = eng.getOutput();
       String a = MyUtil.doubleFormat(n, format);
       if (a.indexOf('.') == -1) a = a+".";
       if ( a.length() > width )
           a = a.substring(0, width); 
       cf.showNumber(a);
   }

   protected void setFormat(int n)
   {   int len = 2*n+1;
       StringBuffer b = new StringBuffer(len);
       for ( int i=0; i < len; i++ )
       {   b.append('#');  }
       b.setCharAt(len/2, '.');
       format= " " + b.toString() + ";" +
               "-" + b.toString();
   }

   protected int width;
   protected String format;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -