Annotation of capa/capa51/JavaTools/Tscore.java, revision 1.2
1.1 albertel 1:
2: /* ====================================================
3: created by Isaac Tsai, 1999
1.2 ! albertel 4: better score extraploator widget
! 5: Copyright (C) 1992-2000 Michigan State University
! 6:
! 7: The CAPA system is free software; you can redistribute it and/or
! 8: modify it under the terms of the GNU Library General Public License as
! 9: published by the Free Software Foundation; either version 2 of the
! 10: License, or (at your option) any later version.
! 11:
! 12: The CAPA system is distributed in the hope that it will be useful,
! 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
! 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 15: Library General Public License for more details.
! 16:
! 17: You should have received a copy of the GNU Library General Public
! 18: License along with the CAPA system; see the file COPYING. If not,
! 19: write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
! 20: Boston, MA 02111-1307, USA.
! 21:
! 22: As a special exception, you have permission to link this program
! 23: with the TtH/TtM library and distribute executables, as long as you
! 24: follow the requirements of the GNU GPL in regard to all of the
! 25: software in the executable aside from TtH/TtM.
! 26: */
! 27:
1.1 albertel 28: <CENTER>
29:
30: <APPLET CODE=Tscore.class CODEBASE=JAVA/Class width=550 height=304>
31: <PARAM NAME="HW_W" VALUE="0.3"> <!- Weight for Homework assignments -!>
32: <PARAM NAME="QZ_W" VALUE="0.07"> <!- Weight for Quizzes -!>
33: <PARAM NAME="EX_W" VALUE="0.3"> <!- Weight for examinations and makeups -!>
34: <PARAM NAME="FE_W" VALUE="0.35"> <!- Weight for final examination -!>
35: <PARAM NAME="PC_W" VALUE="0.3"> <!- Makeup exam discount factor -!>
36: <PARAM NAME="HW_S" VALUE=""> <!- Homework scores so far -!>
37: <PARAM NAME="HW_C" VALUE=""> <!- Number of sets contributed to Homework score -!>
38: <PARAM NAME="HW_R" VALUE=""> <!- Number of sets to be extrapolated -!>
39: <PARAM NAME="QZ_S" VALUE=""> <!- Quizz scores so far -!>
40: <PARAM NAME="QZ_C" VALUE=""> <!- Number of sets contributed to Quiz score -!>
41: <PARAM NAME="QZ_R" VALUE=""> <!- Number of sets to be extrapolated -!>
42: <PARAM NAME="EX_S" VALUE=""> <!- Exam scores so far (exclude exam4, which is final exam) -!>
43: <PARAM NAME="EX_C" VALUE=""> <!- Number of sets contributed to exam score (must be between 1 to 3) -!>
44: <PARAM NAME="EX_R" VALUE=""> <!- Number of sets to be extrapolated -!>
45: <PARAM NAME="FE_S" VALUE=""> <!- Final exam score -!>
46: <PARAM NAME="FE_X" VALUE="">
47: </APPLET>
48:
49: </CENTER>
50: <APPLET
51: [CODEBASE = codebaseURL]
52: CODE = appletFile
53: [ALT = alternateText]
54: [NAME = appletInstanceName]
55: WIDTH = pixels
56: HEIGHT = pixels
57: [ALIGN = alignment]
58: [VSPACE = pixels]
59: [HSPACE = pixels]
60: >
61: [< PARAM NAME = appletParameter1 VALUE = value >]
62: [< PARAM NAME = appletParameter2 VALUE = value >]
63: . . .
64: [alternateHTML]
65: </APPLET>
66:
67: */
68:
69: import java.applet.*;
70: import java.awt.*;
71: import java.lang.*;
72: import java.util.*;
73: import java.net.*;
74:
75: public class Tscore extends Applet implements Runnable
76: {
77:
78: public float hw_w;
79: public float qz_w;
80: public float ex_w;
81: public float fe_w;
82: public float hw_s;
83: public int hw_c;
84: public int hw_r;
85: public float qz_s;
86: public int qz_c;
87: public int qz_r;
88: public float ex_s;
89: public int ex_c;
90: public int ex_r;
91: public float fe_s;
92: public float fe_x;
93:
94: public float hw_ext;
95: public float qz_ext;
96: public float ex_ext;
97: public float fe_ext;
98: public float term_score;
99:
100: public void init()
101: {
102: String p, q;
103:
104:
105: p=getParameter("HW_W");
106: hw_w=(p==null)?1:Float.valueOf(p).floatValue();
107: p=getParameter("QZ_W");
108: qz_w=(p==null)?1:Float.valueOf(p).floatValue();
109: p=getParameter("EX_W");
110: ex_w=(p==null)?1:Float.valueOf(p).floatValue();
111: p=getParameter("FE_W");
112: fe_w=(p==null)?1:Float.valueOf(p).floatValue();
113: p=getParameter("PC_W");
114: pc_w=(p==null)?1:Float.valueOf(p).floatValue();
115:
116: p=getParameter("HW_C");
117: hw_c=(p==null)?1:Integer.valueOf(p).intValue();
118: p=getParameter("HW_S");
119: hw_s=(p==null)?1:Float.valueOf(p).floatValue();
120: p=getParameter("HW_R");
121: hw_r=(p==null)?1:Integer.valueOf(p).intValue();
122:
123: p=getParameter("QZ_C");
124: qz_c=(p==null)?1:Integer.valueOf(p).intValue();
125: p=getParameter("QZ_S");
126: qz_s=(p==null)?1:Float.valueOf(p).floatValue();
127: p=getParameter("QZ_R");
128: qz_r=(p==null)?1:Integer.valueOf(p).intValue();
129:
130: p=getParameter("EX_C");
131: ex_c=(p==null)?1:Integer.valueOf(p).intValue();
132: p=getParameter("EX_S");
133: ex_s=(p==null)?1:Float.valueOf(p).floatValue();
134: p=getParameter("EX_R");
135: ex_r=(p==null)?1:Integer.valueOf(p).intValue();
136:
137: p=getParameter("FE_S");
138: fe_s=(p==null)?1:Float.valueOf(p).floatValue();
139: p=getParameter("FE_X");
140: fe_x=(p==null)?1:Integer.valueOf(p).intValue();
141:
142: }
143:
144: public void paint(Graphics g)
145: {
146: int idx;
147: Dimension d = size();
148: int appw = d.width;
149: int apph = d.height;
150: int x1,y1,x2,y2;
151:
152: g.setFont(f16);
153: if( img != null ) {
154: g.drawImage(img, 0, 0, this);
155: } else {
156: g.setColor(Color.white);
157: g.fillRect(0, 0, appw, apph);
158: }
159: g.setColor(Color.black);
160: for(idx=0;idx<label_cnt;idx++){
161: g.drawString(sLabel[idx],Xcord[idx],Ycord[idx]);
162: }
163: if((show_grid == 1) && (grid_ww>1)) {
164: for(x1=0,y1=0,y2=apph;x1<=appw;x1=x1+grid_ww) {
165: x2=x1;
166: g.drawLine(x1,y1,x2,y2);
167: }
168: for(x1=0,y1=0,x2=appw;y1<=apph;y1=y1+grid_ww) {
169: y2=y1;
170: g.drawLine(x1,y1,x2,y2);
171: }
172: }
173: }
174: public void run() { }
175: public void start() { }
176: public void stop() { }
177:
178: }
179:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>