calculator

Shipping calculator, What am I missing in this code to make it work?

本秂侑毒 提交于 2019-12-12 05:38:56
问题 Hello I am pretty new to this and I am trying to make this shipping calculator code work. This is what I have so far. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ent"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Calculate Shipping</title> <script type="text/javascript"> /* <![CDATA[ */ var price = 0; var shipping = (calculateShipping(price);); var total = price + shipping; function

Regular Expression to match spaces between numbers and operators but no spaces between numbers

心已入冬 提交于 2019-12-12 05:00:07
问题 I've searched many post on this forum and to my surprise, I haven't found anyone with a problem like mine. I have to make a simple calculator for string values from console. Right now,I'm trying to make some regexes to validate the input. My calculator has to accept numbers with spaces between the operators (only + and - is allowed) but not the ones with spaces between numbers, to sum up: 2 + 2 = 4 is correct, but 2 2 + 2 --> this should make an error and inform user on the console that he

android program crashing (new to platform)

你说的曾经没有我的故事 提交于 2019-12-12 04:46:34
问题 So it is my first real Android program (!hello world), but i do have java experience.The program compiles fine, but on running it crashes as soon as it opens (tried debugging, but it crashes before it hits my breakpoint). Was looking for any advice from anyone who is more experienced with android. package org.me.tipcalculator; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.view.View; import android.widget.Button; import android.widget

Java MVC style calculator is having an issue with an if statement

谁说胖子不能爱 提交于 2019-12-12 03:54:45
问题 I have to make a calculator GUI style in java with MVC style formatting between classes, I'm trying to differentiate between the first number they enter and the second one by having a true/false boolean, so if it's true then the number is the first one, and if its false then it should recognize that it is a new number, and they have already pressed either plus or minus. I use a public boolean method that returns the boolean but the if statement I have in the Calculations class isn't working

How to get Result data from android native calculator

馋奶兔 提交于 2019-12-12 03:48:26
问题 I'm invoking android native calculator from my app, how do i get result data from it.. means i started native calender like this, after finishing calculation i press back onActivityResult is not executing.. Help me Intent i = new Intent(); i.setClassName("com.android.calculator2", "com.android.calculator2.Calculator"); startActivityForResult(i, 1); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == 1){ Log.i("CALCULATOR", "Result Data

How to optimize this short script in php - salary calc

纵饮孤独 提交于 2019-12-12 03:36:23
问题 please help me to shorten the code if it si possible. It is working correctly but to echo all the elements of the salary I have to repeat this: $pensjaBrutto = $_GET['pensjaBrutto']; Is it possible to omit this repetition? here is the code: <form method="get" action=""> <meta charset="UTF-8"> <label>Wprowadź kwotę zarobków <u>brutto</u></label> <br> <input type="text" name="pensjaBrutto" value="<?=(isset( $_GET['pensjaBrutto'] ))?$_GET['pensjaBrutto']:''?>"/> <br> <input type="submit" /> <

JavaFX begginer's simple calculator event handling

只谈情不闲聊 提交于 2019-12-12 03:35:42
问题 Hey I'm a begginer at java and i've only been doing this for a short period of time, anyways for my final project in java basics i need to make a simple calculator with a gui, i thought it won't be that hard but i was kinda wrong :P i have managed to do the most (i think) but am stuck atm with the event handling for the operations and setting the value to calculate, here is my code and could you please give me suggestions or tips on how to do it :D import javafx.event.ActionEvent; import

javascript calculator: plus sign alternatives

元气小坏坏 提交于 2019-12-12 03:28:58
问题 As I was researching my current question this article seemed to be promising but I could not figure out for myself if it was the answer to my question. So if anyone could help my that would be terrific. This is my Function: function CalculateIMSUB(form) { var Atext = form.input_1.value; var Btext = form.input_2.value; var val = form.val.value; var A = eval(Atext); var B = eval(Btext); if (isNaN(A)) A = 0; if (isNaN(B)) B = 0; var answer = A - B; form.Answer.value = answer; } This is my html:

Crash from attempting to clear a calcuator

穿精又带淫゛_ 提交于 2019-12-12 03:19:43
问题 Hey I'm trying to make a clear button for my polish calculator.. code give me this error when executing the clear button unrecognized selector sent to instance 0x6a6e1e0' there is a button in the interface builder linked to clearBtn this code is in the CalculatorViewController.m display is linked to the UILabel and.. heres the code - (IBAction)clearBtn { if (self.userIsInTheMiddleOfEnteringANumber) { [[self display] setText:@"0"]; [self setUserIsInTheMiddleOfEnteringANumber:NO]; } } -

Why isn't this Ruby calculator working as intended?

血红的双手。 提交于 2019-12-12 02:57:25
问题 This code is intended to be a basic calculator with some features not yet added. Whenever this is run the two beginning puts display, but when the program receives user input it closes. Is there anything fundamentally wrong? I tried debugging for ~1 hour now and I have given up. puts "Hello There. What you you like to calculate?" puts "You have the option of Distance, Slope, Pythag, Fibonacci, and Sales Tax" calculationSelection = gets if calculationSelection == "Distance" puts "You have