Results 1 to 2 of 2
Thread: Percentage/price script
Jun 20, 2007, 21:47 #1
- Join Date
- Jun 2007
- 0 Post(s)
- 0 Thread(s)
The main goal of the project is that the function needs to return a final price based on two given percentages. There are two coffee types - Espresso ($5.99 per unit) and Sumatra ($8.99 per unit). I want to create a script that will allow me to mix the two types of coffee into one unit. The total percentage of this unit, of course, must equal 100%.
On the GUI, one textbox is for the percent Espresso and another is for the percent Sumatra. If the sum of these percents, equals one hundred, then the user can click the "Find Price" button and the final price will be displayed in a textbox below.
I just don't know how to correctly get the function to work. Once the percents are inputted, I want it to check if the sum of the percents equals 100. If it doesn't I want an alert box to pop up. If it does equal 100, I want it to do generate the final price by the formula ((Espresso * 5.99 + Sumatra * 8.99) / 100).
Here's the code I have so far:
Thanks for your help.