version 1.2, 1999/11/29 19:56:28
|
version 1.4, 2000/07/07 16:57:17
|
Line 1
|
Line 1
|
|
/* old score extrapolator widget |
|
Copyright (C) 1992-2000 Michigan State University |
|
|
|
The CAPA system is free software; you can redistribute it and/or |
|
modify it under the terms of the GNU Library General Public License as |
|
published by the Free Software Foundation; either version 2 of the |
|
License, or (at your option) any later version. |
|
|
|
The CAPA system is distributed in the hope that it will be useful, |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
Library General Public License for more details. |
|
|
|
You should have received a copy of the GNU Library General Public |
|
License along with the CAPA system; see the file COPYING. If not, |
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
Boston, MA 02111-1307, USA. |
|
|
|
As a special exception, you have permission to link this program |
|
with the TtH/TtM library and distribute executables, as long as you |
|
follow the requirements of the GNU GPL in regard to all of the |
|
software in the executable aside from TtH/TtM. |
|
*/ |
|
|
import java.applet.*; |
import java.applet.*; |
import java.awt.*; |
import java.awt.*; |
import java.lang.*; |
import java.lang.*; |
Line 111 public void init() {
|
Line 135 public void init() {
|
// if epc 1 is not given, use exam 1 as epc 1 |
// if epc 1 is not given, use exam 1 as epc 1 |
// if exam 2 is not given, use exam 1 to extrapolate |
// if exam 2 is not given, use exam 1 to extrapolate |
// if exam 3 is not given, use exam 2 to extrapolate |
// if exam 3 is not given, use exam 2 to extrapolate |
// |
// I am lying, I only use the homework score |
|
|
float exam_sum = (float)0.0; |
float exam_sum = (float)0.0; |
for(idx=0;idx<Exam_cnt;idx++) { |
for(idx=0;idx<Exam_cnt;idx++) { |
Line 132 public void init() {
|
Line 156 public void init() {
|
} else { |
} else { |
Exam_ratio[idx] = Raw_exam_ratio[idx]; |
Exam_ratio[idx] = Raw_exam_ratio[idx]; |
} |
} |
|
//System.out.print("idx="+idx+":Exam_ratio="+Exam_ratio[idx]+"\n"); |
Sum_ratio[2*(idx+1)] = Exam_ratio[idx]; |
Sum_ratio[2*(idx+1)] = Exam_ratio[idx]; |
tmp_i = (int)(10000 * Exam_ratio[idx] ); |
tmp_i = (int)(10000 * Exam_ratio[idx] ); |
Sum_percent[2*(idx+1)] = (float)tmp_i / (float)100.0; |
Sum_percent[2*(idx+1)] = (float)tmp_i / (float)100.0; |
Line 268 class ExpPanel extends Panel
|
Line 292 class ExpPanel extends Panel
|
float sf_ratio = (float)ss / (float)ff; |
float sf_ratio = (float)ss / (float)ff; |
tmp_i = (int)(10000 * sf_ratio); |
tmp_i = (int)(10000 * sf_ratio); |
float sf_percent = (float)tmp_i / (float)100.0; |
float sf_percent = (float)tmp_i / (float)100.0; |
float sum_ratio = (float)(ss + ((float)rr*ff*sf_ratio/(float)cc)) / (float)(ff*(1.0 + (float)rr/(float)cc)); |
float sum_ratio = (float)(ss + ((float)rr*ff*sf_ratio/(float)(cc+rr))) / (float)(ff*(1.0 + (float)rr/(float)(cc+rr))); |
|
//System.out.print("ss ="+ss+":rr="+rr+":ff="+ff+":sf_ratio="+sf_ratio+":cc="+cc+":sum_ratio="+sum_ratio+"\n"); |
tmp_i = (int)(10000 * sum_ratio); |
tmp_i = (int)(10000 * sum_ratio); |
float sum_percent = (float)tmp_i / (float)100.0; |
float sum_percent = (float)tmp_i / (float)100.0; |
|
|
Line 363 class ExpPanel extends Panel
|
Line 388 class ExpPanel extends Panel
|
double f; |
double f; |
try { |
try { |
f = (double)Double.valueOf(exT.getText()).doubleValue(); |
f = (double)Double.valueOf(exT.getText()).doubleValue(); |
|
if (f > max) {f=max;} |
} catch (java.lang.NumberFormatException e) { |
} catch (java.lang.NumberFormatException e) { |
f = 0.0; |
f = 0.0; |
} |
} |
Line 388 class ExpPanel extends Panel
|
Line 414 class ExpPanel extends Panel
|
} |
} |
void recalcSumm(int tf) { |
void recalcSumm(int tf) { |
float my_r = (float) tf / (float)100.0; |
float my_r = (float) tf / (float)100.0; |
int tmp_i= (int)(10000*(ss+(rr*ff*my_r/cc))/(float)(ff*(1.0+rr/cc))); |
int tmp_i= (int)(10000*(ss+((float)rr*ff*my_r/(cc+rr)))/(float)(ff*(1.0+(float)rr/(cc+rr)))); |
|
//System.out.print("ss ="+ss+":rr="+rr+":ff="+ff+":my_r="+my_r+":cc="+cc+":tmp_i="+((float)tmp_i/10000.0)+"\n"); |
float sum = (float)tmp_i / (float)100.0; |
float sum = (float)tmp_i / (float)100.0; |
sumL.setText(sum + "%"); |
sumL.setText(sum + "%"); |
controller.recalcTermScore(); |
controller.recalcTermScore(); |
Line 459 class ExmPanel extends Panel
|
Line 486 class ExmPanel extends Panel
|
|
|
if( exam_x == 0 ) { |
if( exam_x == 0 ) { |
// exam not extrapolated |
// exam not extrapolated |
exam_ratio = (float)s_ex / (float)f_ex; |
if ((float)f_ex < 0.00000001) { |
|
exam_ratio = (float) 0.0; |
|
} else { |
|
exam_ratio = (float)s_ex / (float)f_ex; |
|
} |
tmp_i = (int) (10000 * exam_ratio ); |
tmp_i = (int) (10000 * exam_ratio ); |
float percent = (float)tmp_i / (float)100.0; |
float percent = (float)tmp_i / (float)100.0; |
String cs = " " + a + "/" + b + " = " + percent + " %"; |
String cs = " " + a + "/" + b + " = " + percent + " %"; |
Line 536 class ExmPanel extends Panel
|
Line 567 class ExmPanel extends Panel
|
gridbag.setConstraints(eL, c); |
gridbag.setConstraints(eL, c); |
add(eL); |
add(eL); |
if( epc_x == 0 ) { |
if( epc_x == 0 ) { |
float ratio = (float) ( s_pc / f_pc); |
float ratio; |
|
if ((float)f_pc < 0.00000001) { |
|
ratio = (float) 0.0; |
|
} else { |
|
ratio = (float) ( s_pc / f_pc); |
|
} |
tmp_i = (int) (10000 * ratio ); |
tmp_i = (int) (10000 * ratio ); |
float percent = (float)tmp_i / (float)100.0; |
float percent = (float)tmp_i / (float)100.0; |
String cs = " " + s_pc + "/" + f_pc + " = " + percent + " %"; |
String cs = " " + s_pc + "/" + f_pc + " = " + percent + " %"; |