Solved

percentages

Posted on 2004-10-10
5
364 Views
Last Modified: 2010-04-05
hey all, my question is

to keep it simple, lets say you have a bar thats 100 hundred long, and you have a line on it thats 36 long, what percentage would that line be long?
and vice versa, if you knew the percentage the line should be... how long would the line be?

Im usually very good in math, but for some reason Im having probs with this LOL
thanks in advance =)
0
Comment
Question by:LMuadDIb
[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
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
brunomsilva earned 125 total points
ID: 12272775
Hi LMuadDIb,

36/100 = 0.36 = 36%

to find the opposite, suppose the bar is 150 long and you want a line that has 10%, multiply 150 * 10% (0.1) = 15

Cheers!
0
 
LVL 4

Author Comment

by:LMuadDIb
ID: 12272830
with a funtion I made I get an
[Error] misc.pas(22): Incompatible types: 'Integer' and 'Extended'

in delphi code, if you wanted a button to be 25% of the width of the form its sitting on, how would you code it?
0
 
LVL 4

Author Comment

by:LMuadDIb
ID: 12272853
DOH!
I also figured out my error which was another DOH! ;)
thanx
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12272867
Expanding on brunomsilva,

__________________________________________________
Part A)
To calculate it in delphi:

Percentage:=(36 div 100) * 100; //will give you the percentage of 36

PartB)
The opposite (using brunomsilva example):

Length:=(150 * (10 div 100)); //will give you the length of 15

__________________________________________________

Similarly if we use straight variables so that it can be changed dynamically:
Part A)

var Percentage,linelength,barlength:Integer;
begin
       Percentage:=(LineLength div BarLength) * 100;
end;

Part B)

var Percentamount,Linelength,barlength:Integer;
begin
      LineLength:=(BarLength * (PercentAmount div 100));
end;
__________________________________________________

Regards,

Hypoviax

 
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12272870
I was a bit slow in typing my post!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 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