•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,199 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,266 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 359 | Replies: 4
![]() |
Hi all......
Here is my requirement. I am clear with my logic. But i am blocked at Code. How can i get this...
Here is the example...
I need to produce a Score card.
Where i need to calculate score of a dealer as per Question category and the Customers reply.
I am trying to clear my Need here.
Suppose The data is as Follows
1) dealer "A"
2) Question Category "1"
3) Number Of question in Category "1" = 2
4) Marks for Question = 1 (N) else 4(Y)
If Dealer "A" has 4 customers and 2 of them replied then.
Here are the Inputs for Scorecard.
1) Total Question for Dealer "A" of Category "1" => 2(Customers) * 2 (Questions) = 4
2) Marks = 4 * 4 = 16 (Considering Y case)
3) Total Marks = 16
Here the score of Dealer "A" is "100%" MI right? If yes then please tell me how to get this by calculation. Please Help me.
Thanks in advance.
Have a Nice Time.
Here is my requirement. I am clear with my logic. But i am blocked at Code. How can i get this...
Here is the example...
I need to produce a Score card.
Where i need to calculate score of a dealer as per Question category and the Customers reply.
I am trying to clear my Need here.
Suppose The data is as Follows
1) dealer "A"
2) Question Category "1"
3) Number Of question in Category "1" = 2
4) Marks for Question = 1 (N) else 4(Y)
If Dealer "A" has 4 customers and 2 of them replied then.
Here are the Inputs for Scorecard.
1) Total Question for Dealer "A" of Category "1" => 2(Customers) * 2 (Questions) = 4
2) Marks = 4 * 4 = 16 (Considering Y case)
3) Total Marks = 16
Here the score of Dealer "A" is "100%" MI right? If yes then please tell me how to get this by calculation. Please Help me.
Thanks in advance.
Have a Nice Time.
Accept Challenges and Enjoy Coding... :)
•
•
Join Date: Sep 2007
Posts: 1,057
Reputation:
Rep Power: 4
Solved Threads: 61
Not sure exactly what you mean here, but for your info, for calculating it easily, avoid 1 and 4 for yes and no.
Use 0 for no, 1 for yes. This way:
2 questions right, 2 questions wrong
0 + 2 = 2
2/4 = 50%
For 1 and 4, you are looking at some intense calculation, or substituting like the following:
if 1 then 0, if 4 then 1.
You can do it anyway you wish, but if they get it wrong, do NOT add any points. Otherwise your calculations will be just about impossible.
If you wish, keep it 0 and 4. Then just divide by 4.
2 right, 2 wrong
8/(4*4)
(Total Points) / (Points per correct answer * number of questions)
Something like this would work for your current situation:
Now if you had it 0 for no, 1 for yes, then all you would have to do is count each element and sum them all up.
Then divide the sum by the total count and you would have it. Make sure it's decimal, as if you put integer, it will round to the nearest whole number.
An example of this would be:
Use 0 for no, 1 for yes. This way:
2 questions right, 2 questions wrong
0 + 2 = 2
2/4 = 50%
For 1 and 4, you are looking at some intense calculation, or substituting like the following:
if 1 then 0, if 4 then 1.
You can do it anyway you wish, but if they get it wrong, do NOT add any points. Otherwise your calculations will be just about impossible.
If you wish, keep it 0 and 4. Then just divide by 4.
2 right, 2 wrong
8/(4*4)
(Total Points) / (Points per correct answer * number of questions)
Something like this would work for your current situation:
VB.NET Syntax (Toggle Plain Text)
Dim y As Integer = 0 Dim n As Integer = 0 Dim Questions() As String = {1,4,4,1,4,4,4,4,1,4} For Each answer As Integer In Questions Select Case answer Case 1 : n += 1 Case 4 : y += 1 End Select Next Dim percentRight As Decimal = FormatNumber((y/(n+y))*100, 1) Response.Write(percentRight & "%")
Then divide the sum by the total count and you would have it. Make sure it's decimal, as if you put integer, it will round to the nearest whole number.
An example of this would be:
VB.NET Syntax (Toggle Plain Text)
Dim Questions() As String = {0,1,1,0,1,1,1,1,0,1} Dim percentRight As Decimal = FormatNumber((Questions.Sum()/Questions.Length)*100, 1) Response.Write(percentRight & "%")
Last edited by SheSaidImaPregy : Mar 18th, 2008 at 10:04 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Parse and mail log files (Perl)
- viewing the end of a log file (Linux Users Lounge)
- HJT Log - Spyaxe? (Viruses, Spyware and other Nasties)
- HijackThis Log (Viruses, Spyware and other Nasties)
- Recent Trojan - HTJ Log? (Viruses, Spyware and other Nasties)
- please check this HJT log (Viruses, Spyware and other Nasties)
- HJT Log, Need assistance removing "Blue Bar" (Viruses, Spyware and other Nasties)
- Hijacked Internet Explorer--log included (Viruses, Spyware and other Nasties)
Other Threads in the ASP.NET Forum
- Previous Thread: Storing Views and File information
- Next Thread: Could someone help me how to add value to A item based on other selected value??(c#)



Linear Mode