calculator

Adding the values of 2 textboxes to display result in one of them

丶灬走出姿态 提交于 2019-12-12 02:32:19
问题 On my form I have 2 textboxes called 'txtsurcharges.text' and 'txttotal.text' txttotal retrieves a value from mysql table, but what I want to happen is that this value becomes added to when I type in a value into txtsurcharges and display the result in txttotal. Here is my code for txtsurcharges: txtsurcharges.Text = String.Format("£{0}", txtsurcharges.Text) Here is my code for txttotal: Private Sub cbxPaymentID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

C# Calculator typing by pressing buttons

非 Y 不嫁゛ 提交于 2019-12-12 02:23:21
问题 I am studying C# now, so i am making some kind of exercises to get used to C# syntax and learn better. I decided to make a calculator looking alike the normal windows calculator. I created only one button "1" and one textbox. I want to make this button write 1 in textbox when I press it and also make an int variable equal to the number in the textbook, to make the calculation later. So I can't either change "int a"'s value or change text in the textbox, it always shows 01, because a always

Making a simple calculator with arrays in C#

混江龙づ霸主 提交于 2019-12-12 02:16:33
问题 I am trying to make a simple calculator with arrays in C#. Firstly I tried making it using two integers and one operator only and it worked well. Now I am trying to do so that the user can make the expression as long as they like. For example 7 * 7 + 1 / 50 instead of a simple 9 + 8 which includes only one operator and two integers. The problem is that whenever I type a long expression with multiple numbers and operators it only calculates the first 2 numbers with the first operator. What is

php mysql multiply database value with form selection

被刻印的时光 ゝ 提交于 2019-12-12 02:13:14
问题 Hello I am really struggling with this. I was asked to develop a script to calculate oil price but cannot get it to work. I have been able to setup a form to update fuel price. I have a table called fuel_price. In this table will be cost per litre of fuel which is stored under Price. For example if oil price per litre is £0.50 I need to multiply this value by value selected within form dropdown. Can anyone please guide me on what I am supposed to do?? Ok heres an update code preview. <form

Why is my NSRange always 0?

眉间皱痕 提交于 2019-12-11 18:33:10
问题 I want to implement a delete key for my calculator app. My pseudocode for this was: foo = length of current number bar = length of current number-1 current number = current number with character at index (foo-bar) removed To do this in objective-c I have tried to implement this using the NSRange function as well as the StringbyappendingString method: - (IBAction)DelPressed { if ([self.display.text length] >=2) { int len = [self.display.text length];//Length of entire display //Add to the

Make clear button backspace by one in python tkinter calculator

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 17:34:12
问题 I am making a calculator in python using tkinter. The calculator works very well apart from one thing. At the moment I have set the calculator to clear the display. I want to make it so that it clears the last number on the display. For example 564 would become 56. Any help greatly appreciated. #Import tkinter from Tkinter import * #Setup quit button def quit(): window.destroy() #What happens when you click the button def buttonclick(event): global calcvalue global savedvalue global operator

Calculator function outputs nothing

坚强是说给别人听的谎言 提交于 2019-12-11 15:51:52
问题 I need to design a calculator with the following UI: Welcome to Calculator! 1 Addition 2 Subtraction 3 Multiplication 4 Division Which operation are you going to use?: 1 How many numbers are you going to use?: 2 Please enter the number: 3 Please enter the number: 1 The answer is 4. This is what I have so far: print("Welcome to Calculator!") class Calculator: def addition(self,x,y): added = x + y return sum def subtraction(self,x,y): diff = x - y return diff def multiplication(self,x,y): prod

How to get user friendly values for trigonometric functions?

给你一囗甜甜゛ 提交于 2019-12-11 13:42:49
问题 I am developing an android app. for mathematical calculations. There I have some buttons like sin,cos,tan which should show their respective trigonometric values, for that I am using corresponding methods of java.lang.Math class and that works fine. But after some tests I came to know that, it shows some results as follows sin(90)=0.89399........ //I want it to show 1 cos(90)=-0.44807........ //I want it to show 0 tan(90)=-1.995200...... //I want it to show Infinity as sin(90)/cos(90)=1/0

How to make a RPN calculator (Java)

冷暖自知 提交于 2019-12-11 13:17:50
问题 I have an assignment and I need a bit of help, there seems to be an error when doing more than one calculation using RPN format. I use the example input as given in the link below. On the first input (16 3 7 + *) it gives me the correct answer (160). But, the next two inputs (4 32.125 13 – * 20 +) and (5 –3 * 4 2 / 6 3 1 – / + +) return "error." Thanks for your help in advance, if you need some more information don't be afraid to ask. The assignment details: Details My code so far: import

Java estimate a derivative at a point

被刻印的时光 ゝ 提交于 2019-12-11 07:44:29
问题 I am currently writing a calculator application. I am trying to write a derivative estimator into it. The formula below is a simple way to do it. Normally on paper you would use the smallest h possible to get the most accurate estimate. The problem is doubles can't handle adding really small numbers to comparatively huge numbers. Such as 4+1E-200 will just result in 4.0. Even if h was just 1E-16, 4+1E16 will in fact give you the right value but doing math it it is inaccurate because anything