Link to home
Start Free TrialLog in
Avatar of TherosEquipment
TherosEquipment

asked on

Multiply an Integer by a Percentage (arg!)

Hello,

I know this should be simple, but it's kicking my butt!
Here is what I got...

editbox1 contains a string representing a dollar amount
example = [58]

editbox6 contains a value representing a discount off of the price in editbox1
example = Discount [20] %

How do I calculate this and represent it in another string?

listview1.subitems[1].add(IntToStr(StrToInt(editbox1.text) * percentage));


Thanks!
ASKER CERTIFIED SOLUTION
Avatar of vacerose
vacerose

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BlackTigerX
BlackTigerX

var
  percentage:real;
begin

percentage:=StrToFloat(editbox6.text) / 100;

listview1.subitems[1].add(IntToStr(StrToInt(editbox1.text) * percentage));
Avatar of TherosEquipment

ASKER

I had to modify what you did, but you pointed me in the right direction...

listitem.subitems.Add(FloatToStr(StrToFloat(flatedit4.text) * (1 - (StrToFloat(flatedit6.text) / 100))));