Jump to content

Recommended Posts

Posted

What i'm tring to do is to do a simple calculate:

and have it round to the nearest cent.

ex:

$325.50 + 10% = ???

I have an input box for the percent. In it the user will typy "10" for 10%

here are the vars.

$total_price = 325.50 ;(or what they enter into the input box)

$markup_percent = 10 ; (or what they enter into the input box)

$makeup_amount = ???

$total_price_after_markup =???

Need a website: http://www.iconixmarketing.com

Posted

$markup_amount=round(100*$total_price/$markup_percent,2)
$total_price_after_markup=$markup_amount + $total_price

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Posted

That works THANK you I just need to swich some var

$markup_amount=round($markup_percent/100*$total_price,2)

$total_price_after_markup=$markup_amount + $total_price

Need a website: http://www.iconixmarketing.com

Posted

The order of multiplying and dividing does not matter at all, try both, you will get the same answer.

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

  • Developers
Posted (edited)

The order of multiplying and dividing does not matter at all, try both, you will get the same answer.

true .... but are you sure about the fomula?

shouldn't that be? :

$markup_amount=round($total_price*$markup_percent/100,2)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Sorry, I mixed up my formula. I divided the total price by decimal percent. You are correct grandmaster JdeB.

@ OP

Sorry for the confusion.

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...