JAVA Windows Calculator – 输出中的反复求逆是恒定的

huangapple 未分类评论48阅读模式
标题翻译

JAVA Windows Calculator - Inverse Repetition is Constant on the Output

问题

以下是您要求的翻译内容:

你好,我又回来了,我是来自菲律宾的计算机工程专业一年级学生。我有一个未完成的 Windows 计算器,我需要你帮助我完成我的作业。我已经实现了计算器所需的数字和运算功能,

问题: 例如,我输入的数字是 1

我点击了两次倒数按钮,上面的输出只有 1/(1),而不是 1/(1/1),就像 Windows 计算器上的效果一样。我想在不使用连接操作的情况下有一种简单的方法来实现这个。

请帮助我,作为一个新手,谢谢。以下是我的代码:

public void actionPerformed(ActionEvent e) {
    String global = global.concat("1/(" + inputtedNumber + ")");
    textInput.setText(global);
    textOutput.setText(1 / inputtedNumber);	
}

textInput 用于显示输入,比如 1/(1),而 textOutput 则用于显示倒数的结果。

英文翻译

Hi there I am here again, 1st Year Computer Engineering Student from the Philippines, I have an unfinished windows calculator, I just need your help for my assignment. I already have the function of numbers and operations that is needed for my calculator,

PROBLEM: for example the number I inputted is 1

I clicked inverse two times, the output above is only 1/(1) instead of 1/(1/1)) and so on just like on windows calculator. I think there is an easy way to do this besides using concat.

Please help me also a newbie here thank you. Here is my codes:

		public void actionPerformed(ActionEvent e) {
			String global = global.concat("1/("+ inputtedNumber + ")");
			textInput.setText(global);
			textOutput.setText(1 / inputtedNumber);	

textInput is for the input like these 1/(1) while the textOutput is for the answer of inverse.

答案1

得分: 0

你是这样的意思吗?显示使用反向多次的win10计算器的图像。

英文翻译

Do you mean like this? image of win10 calculator using inverse multiple times.

huangapple
  • 本文由 发表于 2020年3月16日 13:00:08
  • 转载请务必保留本文链接:https://java.coder-hub.com/60700537.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定