Annotation of capa/capa51/Tscore.java, revision 1.1.1.1

1.1       albertel    1: 
                      2: /* ====================================================
                      3:    created by Isaac Tsai, 1999
                      4:    Copyrighted 1999, 2000 Isaac Tsai
                      5: <CENTER>
                      6: 
                      7: <APPLET CODE=Tscore.class CODEBASE=JAVA/Class width=550 height=304>
                      8: <PARAM NAME="HW_W"  VALUE="0.3">  <!- Weight for Homework assignments -!>
                      9: <PARAM NAME="QZ_W"  VALUE="0.07"> <!- Weight for Quizzes -!>
                     10: <PARAM NAME="EX_W"  VALUE="0.3">  <!- Weight for examinations and makeups -!>
                     11: <PARAM NAME="FE_W"  VALUE="0.35"> <!- Weight for final examination -!>
                     12: <PARAM NAME="PC_W"  VALUE="0.3">  <!- Makeup exam discount factor -!>
                     13: <PARAM NAME="HW_S"  VALUE="">  <!- Homework scores so far -!>
                     14: <PARAM NAME="HW_C"  VALUE="">  <!- Number of sets contributed to Homework score -!>
                     15: <PARAM NAME="HW_R"  VALUE="">  <!- Number of sets to be extrapolated -!>
                     16: <PARAM NAME="QZ_S"  VALUE="">  <!- Quizz scores so far -!>
                     17: <PARAM NAME="QZ_C"  VALUE="">  <!- Number of sets contributed to Quiz score -!>
                     18: <PARAM NAME="QZ_R"  VALUE="">  <!- Number of sets to be extrapolated -!>
                     19: <PARAM NAME="EX_S"  VALUE="">  <!- Exam scores so far (exclude exam4, which is final exam) -!>
                     20: <PARAM NAME="EX_C"  VALUE="">  <!- Number of sets contributed to exam score (must be between 1 to 3) -!>
                     21: <PARAM NAME="EX_R"  VALUE="">  <!- Number of sets to be extrapolated -!>
                     22: <PARAM NAME="FE_S"  VALUE="">  <!- Final exam score -!>
                     23: <PARAM NAME="FE_X"  VALUE="">
                     24: </APPLET>
                     25: 
                     26: </CENTER>
                     27: <APPLET
                     28:             [CODEBASE = codebaseURL]
                     29:             CODE = appletFile 
                     30:             [ALT = alternateText]
                     31:             [NAME = appletInstanceName]
                     32:             WIDTH = pixels
                     33:             HEIGHT = pixels 
                     34:             [ALIGN = alignment]
                     35:             [VSPACE = pixels]
                     36:             [HSPACE = pixels]
                     37:         >
                     38:         [< PARAM NAME = appletParameter1 VALUE = value >]
                     39:         [< PARAM NAME = appletParameter2 VALUE = value >]
                     40:         . . .
                     41:         [alternateHTML]
                     42:         </APPLET>
                     43: 
                     44: */
                     45: 
                     46: import java.applet.*;
                     47: import java.awt.*;
                     48: import java.lang.*;
                     49: import java.util.*;
                     50: import java.net.*;
                     51: 
                     52: public class Tscore extends Applet implements Runnable
                     53: {
                     54: 
                     55:  public float   hw_w;
                     56:  public float   qz_w;
                     57:  public float   ex_w;
                     58:  public float   fe_w;
                     59:  public float   hw_s;
                     60:  public int     hw_c;
                     61:  public int     hw_r;
                     62:  public float   qz_s;
                     63:  public int     qz_c;
                     64:  public int     qz_r;
                     65:  public float   ex_s;
                     66:  public int     ex_c;
                     67:  public int     ex_r;
                     68:  public float   fe_s;
                     69:  public float   fe_x;
                     70:  
                     71:  public float   hw_ext;
                     72:  public float   qz_ext;
                     73:  public float   ex_ext;
                     74:  public float   fe_ext;
                     75:  public float   term_score;
                     76: 
                     77: public void init()
                     78:  {
                     79:    String   p, q;
                     80: 
                     81:    
                     82:    p=getParameter("HW_W");
                     83:    hw_w=(p==null)?1:Float.valueOf(p).floatValue();
                     84:    p=getParameter("QZ_W");
                     85:    qz_w=(p==null)?1:Float.valueOf(p).floatValue();
                     86:    p=getParameter("EX_W");
                     87:    ex_w=(p==null)?1:Float.valueOf(p).floatValue();
                     88:    p=getParameter("FE_W");
                     89:    fe_w=(p==null)?1:Float.valueOf(p).floatValue();
                     90:    p=getParameter("PC_W");
                     91:    pc_w=(p==null)?1:Float.valueOf(p).floatValue();
                     92:    
                     93:    p=getParameter("HW_C");
                     94:    hw_c=(p==null)?1:Integer.valueOf(p).intValue();
                     95:    p=getParameter("HW_S");
                     96:    hw_s=(p==null)?1:Float.valueOf(p).floatValue();
                     97:    p=getParameter("HW_R");
                     98:    hw_r=(p==null)?1:Integer.valueOf(p).intValue();
                     99:    
                    100:    p=getParameter("QZ_C");
                    101:    qz_c=(p==null)?1:Integer.valueOf(p).intValue();
                    102:    p=getParameter("QZ_S");
                    103:    qz_s=(p==null)?1:Float.valueOf(p).floatValue();
                    104:    p=getParameter("QZ_R");
                    105:    qz_r=(p==null)?1:Integer.valueOf(p).intValue();
                    106:    
                    107:    p=getParameter("EX_C");
                    108:    ex_c=(p==null)?1:Integer.valueOf(p).intValue();
                    109:    p=getParameter("EX_S");
                    110:    ex_s=(p==null)?1:Float.valueOf(p).floatValue();
                    111:    p=getParameter("EX_R");
                    112:    ex_r=(p==null)?1:Integer.valueOf(p).intValue();
                    113:    
                    114:    p=getParameter("FE_S");
                    115:    fe_s=(p==null)?1:Float.valueOf(p).floatValue();
                    116:    p=getParameter("FE_X");
                    117:    fe_x=(p==null)?1:Integer.valueOf(p).intValue();
                    118: 
                    119:  }
                    120:  
                    121: public void paint(Graphics g)
                    122:  {
                    123:    int        idx; 
                    124:    Dimension  d = size();
                    125:    int        appw = d.width;
                    126:    int        apph = d.height;
                    127:    int        x1,y1,x2,y2;
                    128:    
                    129:     g.setFont(f16);
                    130:     if( img != null ) {
                    131:        g.drawImage(img, 0, 0, this);
                    132:     } else {
                    133:        g.setColor(Color.white);
                    134:        g.fillRect(0, 0, appw, apph);
                    135:     }
                    136:     g.setColor(Color.black);
                    137:     for(idx=0;idx<label_cnt;idx++){
                    138:       g.drawString(sLabel[idx],Xcord[idx],Ycord[idx]);
                    139:     }
                    140:     if((show_grid == 1) && (grid_ww>1)) {
                    141:       for(x1=0,y1=0,y2=apph;x1<=appw;x1=x1+grid_ww) {
                    142:         x2=x1;
                    143:         g.drawLine(x1,y1,x2,y2);
                    144:       }
                    145:       for(x1=0,y1=0,x2=appw;y1<=apph;y1=y1+grid_ww) {
                    146:         y2=y1;
                    147:         g.drawLine(x1,y1,x2,y2);
                    148:       }
                    149:     }
                    150:  }
                    151: public void run()   { }
                    152: public void start() { }
                    153: public void stop()  { }
                    154: 
                    155: }
                    156: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>