Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multiply an Integer by a Percentage (arg!)

Posted on 2004-10-29
3
Medium Priority
?
300 Views
Last Modified: 2010-05-18
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!
0
Comment
Question by:TherosEquipment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
vacerose earned 150 total points
ID: 12447989
FloatToStr(StrToFloat(editbox1.text) * StrToFloat(editbox6.text) / 100)
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12448402
var
  percentage:real;
begin

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

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

Author Comment

by:TherosEquipment
ID: 12448422
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))));
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question