Formula for percentage?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2007
Posts: 50
Reputation: Prozeen is an unknown quantity at this point 
Solved Threads: 4
Prozeen's Avatar
Prozeen Prozeen is offline Offline
Junior Poster in Training

Formula for percentage?

 
0
  #1
Oct 9th, 2007
Hi, this is a mathematical question, but I'm doing it in VB so I thought I'd post it here...

A person is shown a total of 10 numbers. When a number appears on the screen they have to type that number into a text box and if they get it correct another number appears. If they do not get it correct they get another chance at getting the original number correct.

I'm trying to work out the accuracy of the values they input (and then I display that accuracy as a percentage when the program has finished.) For example, if they input 11 values (i.e. 1 of them is not the correct number) then I'm guessing the accuracy is approximately 90%. But what is the formula to obtain this figure/percentage?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 192
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: Formula for percentage?

 
0
  #2
Oct 9th, 2007
Do you let them try a second time with the original number and when they get it right the second time you still take off for that? Before you have a formula you have to have the exact rules.
Anyway, let me try to answer your question even without knowing the exact rules, you can adapt it accordingly
let's say you give them 10 questions
you have a variable called mistake. Every time they got an answer wrong you add 1 to mistake.
10 = 100% so for each mistake you take off 10%. So your formula would be
100-(mistake*10)
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: zmariow is an unknown quantity at this point 
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: Formula for percentage?

 
0
  #3
Oct 9th, 2007
You need to have 2 numbers to compute the accuracy:
  • Number of successful attempts (call it s)
  • Number of total attempts (call it t)
And here's the formula: accuracy = (s / t) * 100
Cheers
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 50
Reputation: Prozeen is an unknown quantity at this point 
Solved Threads: 4
Prozeen's Avatar
Prozeen Prozeen is offline Offline
Junior Poster in Training

Re: Formula for percentage?

 
0
  #4
Oct 9th, 2007
Thanks for the help guys. Okay, I tried running the program, using both the formulas you supplied at the same time. When I use the program with no incorrect answers I get...

plusplus = 0
zmariow = 10

And when I have one incorrect answer (i.e. 11 attempts for 10 numbers)...

plusplus = -10
zmariow = 9.090909

From what I can work out plusplus is close to the mark (probably due to my ambiguity) but it's not as accurate as zmariow. So, because I want to show it as a percentage, here's what I came up with...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. res2 =(success / attempt) * 100 * 10
  2. lblresults.caption "Your accuracy is " and res2 & "%"
Is this right?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: zmariow is an unknown quantity at this point 
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: Formula for percentage?

 
0
  #5
Oct 9th, 2007
Originally Posted by Prozeen View Post
...When I use the program with no incorrect answers I get...
plusplus = 0
zmariow = 10
Since you're getting 10 using my formula I assume you're doing something wrong when counting the number of mistakes and the total number.

This is because you should have s and t both equal to 10 and the formula should give you: 100... that is 10/10 * 100 = 100...

Can you show us what are the values of s and t??? (or whatever names you're using for those variables)
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 50
Reputation: Prozeen is an unknown quantity at this point 
Solved Threads: 4
Prozeen's Avatar
Prozeen Prozeen is offline Offline
Junior Poster in Training

Re: Formula for percentage?

 
0
  #6
Oct 9th, 2007
Okay, to cut a long story short, I finally got it. For some reason I had to declare "success" in the general declarations section. I don't know how, but it fixed the problem and now I'm using the exact code you provided zmariow. Thanks for that!
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 72
Reputation: zmariow is an unknown quantity at this point 
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: Formula for percentage?

 
0
  #7
Oct 9th, 2007
You're welcome

I also advice you to investigate this declarations issue in order to avoid more problems later on.

Cheers
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC