calculator

How to have a number to be a power?

天大地大妈咪最大 提交于 2020-01-11 10:06:07
问题 My Javascript has this: (A + B) ? C I have everything else, but how do i have C to be a power? I thought using ^ would work, but it just adds it. 回答1: JavaScript does not have an operator for exponentiation. ^ is actually the bitwise XOR operator. Try using Math.pow instead: var d = Math.pow(a + b, c); 来源: https://stackoverflow.com/questions/21861908/how-to-have-a-number-to-be-a-power

Calculator Based on ATMega8 using AVRstudi

十年热恋 提交于 2020-01-07 08:32:29
问题 About the Calculator: Basically this calculator is made to calculate the resistance of copper and aluminum wires at the ambient temperature using the formula R2= R1*(1+alpha(T-25)) Here R2 will be the output, R1 will be the value entered by the user using a 4x4 matrix keypad (which will include decimal values like 12.5 etc), T is the temperature in degree Celsius recorded by the temperature sensor LM35. alpha for copper = 0.0039 alpha for aluminum = 0.0042 How it should work: Basically the

StackOverFlowError in Java postfix calculator

喜你入骨 提交于 2020-01-07 07:51:09
问题 The following class is used by another program. When it is accessed, it throws a StackOverFlowError. This is part of a Postfix Calculator I have to do as a project at my university. Any help would be greatly appreciated, thank you in advance. I'm quite new at Java and I have no idea what to do. CODE: import java.util.Queue; import java.util.Stack; public class MyPostfixMachine implements PostfixMachineInterface { MyMathOperations mmo = new MyMathOperations(); MyPostfixMachine mpm = new

StackOverFlowError in Java postfix calculator

浪子不回头ぞ 提交于 2020-01-07 07:51:08
问题 The following class is used by another program. When it is accessed, it throws a StackOverFlowError. This is part of a Postfix Calculator I have to do as a project at my university. Any help would be greatly appreciated, thank you in advance. I'm quite new at Java and I have no idea what to do. CODE: import java.util.Queue; import java.util.Stack; public class MyPostfixMachine implements PostfixMachineInterface { MyMathOperations mmo = new MyMathOperations(); MyPostfixMachine mpm = new

Evaluating a mathematical expression

丶灬走出姿态 提交于 2020-01-06 15:39:11
问题 Guys I am up with evaluating a string mathematical expression. First I imported the library using System.Linq.Expressions; Then in my codes I did, Expression e = new Expression("(450*5)+((3.14*7)/50)*100"); double result = e.Evaluate(); however I get the error as Cannot create an instance of the abstract class or interface 'System.Linq.Expressions.Expression' Why the above is not working? How can I evaluate this ? 回答1: In order to evaluate expressions like this in c#, you have to use Roslyn.

Java Determine which textfield has Focus

天涯浪子 提交于 2020-01-06 15:30:31
问题 I have created buttons 1-9 as well as 4 text fields. I am trying to allow the user to click on any number 1-9 to input into each text field. However, I cannot determine which field the user is clicked on. Currently the 1-9 buttons only input text to the amt text field. How can I check which field is clicked and enter input into there? New Question public void actionPerformed(ActionEvent e) { String iamt, ii, iterm,ipay; iamt = amt.getText(); ii = interest.getText(); iterm = term.getText();

Name age does not exist in the current context

一笑奈何 提交于 2020-01-06 08:28:14
问题 I have an assignment to write a simple program in C# on Visual Studio that reads your birth date from the console, prints back your age now and your age after ten years. I've found a Microsoft tutorial and decided to use it but it went wrong. Here's the tutorial: http://channel9.msdn.com/Series/Twenty-C-Questions-Explained/14 I'm not done with the task and I see the following errors: 'The name age does not exist in the current context' . namespace AgeAfterTenYears { class AgeAfterTenYears {

Problems with adding keyboard support to JS calculator

烈酒焚心 提交于 2020-01-06 08:07:22
问题 I want to add keyboard support to my calculator. When i press operations with keyboard (i.e. +,-,* or /) js sees it as number, not as operation. For example, when I compute "10+11" by clicking, I will get "21" as a result. When I do the same with inputing through keyboard, I will get "10". Why does it happen? And is it possible to change it? <!DOCTYPE html> <html> <head> <link href="style.css" type="text/css" rel="stylesheet"> </head> <body> <div class="main"> <div id="output"> <input id=

Calculator in python

女生的网名这么多〃 提交于 2020-01-05 13:52:49
问题 I am trying to make calculator that can solve expressions with basic 4 operators, like 1+2*3-4/5, however it does not work and I do not know what is wrong. Please check my code. When I run it, I am getting infinte number of errors in 8. line return ret(parts[0]) * ret(parts[2]) Here is code def ret(s): s = str(s) if s.isdigit(): return float(s) for c in ('*','/','+','-'): parts = s.partition(c) if c == '*': return ret(parts[0]) * ret(parts[2]) elif c == '/': return ret(parts[0]) / ret(parts[2

Algorithm and Hint for Scientific Calculator [closed]

妖精的绣舞 提交于 2020-01-05 04:40:10
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have a Scientific Calculator project using Java Swing. but, I ended up in wrong calculation. Example: If push button: 1 then + then 2 then * then 3 the answer is 9, not 7. Could you give me a hint, I must use