AT2k Design BBS Message Area
Casually read the BBS message area using an easy to use interface. Messages are categorized exactly like they are on the BBS. You may post new messages or reply to existing messages!

You are not logged in. Login here for full access privileges.

Previous Message | Next Message | Back to Programming  <--  <--- Return to Home Page
   Networked Database  Programming   [38 / 97] RSS
 From   To   Subject   Date/Time 
Message   Winston Smith    Steve Winn   A little help...   April 4, 2004
 6:01 PM *  

  Re: A little help...
  By: Steve Winn to Sean Dennis on Fri Apr 02 2004 09:44 pm

 > You mean like this:
 > 
 > (14 / (total correct)) * 100 = percentage   (round it to make an integer)
 > if (percentage < 100 && > 90) grade = "A"
 > if (percentage < 90 && > 80) grade = "B"
 > etc etc
 > 
 > And please note that the above is not in any programming language i'm aware
 > of.. just wrote it to give you an idea.
 > 
 > Steve
 
You might want to change that to "inclusive" ranges, i.e.
Greater-Than-Or-Equal-To, Less-Than-Or-Equal-To, otherwise...  what happens
when the percentage equals 90 ? ....
Here is a PERL hack that does grade averaging....
# Header for MS-DOS COMMAND.COM shell self-executing '.BAT' file.
# @REM=(qq!
# @perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
# @goto end !) if 0 ;

# Shebang header for UNIX-style shell self-executing script file.
#!/unix/perl4/newperl
 
# The perl script goes here.   

# WARNING: Make sure that the file "grades" has no trailing blank lines
#          or you will get division by zero errors !
open(GRADES, "grades";) or die "Can't open grades: $!\n";
while ($line = <GRADES>;) {
        ($student, $grade) = split(" ", $line);
        $grades{$student} .= $grade . " ";
} 
 
foreach $student (sort keys %grades) { 
        $scores = 0;
        $total = 0;
        @grades = split(" ", $grades{$student} );
        foreach $grade (@grades) { 
                $total += $grade;
                $scores++;
        } 
        $grandtotal += $total;
        $grandscore += $scores;
        $average = $total / $scores; 
        print"$student: $grades{$student}\tAverage: $average\n";
        print"Items: $grandscore\tTotal: $grandtotal\n";
}
# @REM=(qq!
# :end !) if 0 ;

Noel 25
Ben 76
Clementine 49
Norm 66
Chris 92
Doug 42
Carol 25
Ben 12
Clementine 0
Norm 66
Ellen 82
Olaf 74


Risk:  | Severe |  High  | Elevated | Guarded |  Low  |
---
 � Synchronet � TuneMan BBS -- Manville,RI -- Tunemanbbs.mine.nu
--- SBBSecho 2.00-Win32
 * Origin: (( WarZone BBS )) - warzonebbs.net (63:63/104)
  Show ANSI Codes | Hide BBCodes | Show Color Codes | Hide Encoding | Hide HTML Tags | Show Routing
Previous Message | Next Message | Back to Programming  <--  <--- Return to Home Page

VADV-PHP
Execution Time: 0.0171 seconds

If you experience any problems with this website or need help, contact the webmaster.
VADV-PHP Copyright © 2002-2024 Steve Winn, Aspect Technologies. All Rights Reserved.
Virtual Advanced Copyright © 1995-1997 Roland De Graaf.
v2.1.241108