----- Original Message ----- 
From: Paul Steven <[EMAIL PROTECTED]>
Subject: RE: <lingo-l> Displaying Fractions


> Btw the number of questions is not known beforehand - as the question base

If you know how many answers there maximum is to a question you can store the answers 
as integers to a common divider (does this make sense? I have no idea whatsoever these 
things are called in english).

For example:
If you know there are gonna be from 1 to 4 answers to the various questions, the 
common divider would be 12 as 1,2,3 and 4 all can be divided up into 12. The right 
answer to a question with 3 possible answers, would be worth 4 points as 3/12th is 4. 
To a question with 4 possible answers, it would be 3 points. 6 points for 2 and 12 
points for the correct answer in 1 possible.
If there can be from 1 to 8 possible answers, the common divider would be 840 and the 
points given corresponding to that (right answer out of 5 possible would give you 168 
points). If you take the up-added points at any given time, mutiply with 100 and 
divide by the common divider, you will have the percentage. And with no rounding up to 
be nervous about as you are always dealing with integers when adding the points.

As to how you will find out which fraction an floating number is equal to, well, that 
is a science it itself and should be handled carefully, or you might end up with a 
score of 78 126/168 % and that is not very professional. Add to that, you could also 
tell your customer that having percentage numbers in fractions is very controversial 
and not how the percentage scale is supposed to be used. After all, percentage in 
itself a converted fraction (it means "per hundred"), so 1 1/3 % really means "one and 
one per third per hundred". In the ancient Rome they would have laughed their arses 
off of this dumb tourist.   ;-)

I really hope I'm making myself clear. I'm not very good with mathematical or 
scientific terms in english, so I rely on you remembering your basic school math. 
(which is tough for me once in a while ;-)

happy coding

/jonas



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to