/* * Results.java 12/3/99 * CIS 375, Dr. Maxim * By Doug Code, Brad Lloyd and Mitchelle Zukowski * */ import java.awt.*; import java.applet.Applet; import java.awt.event.*; /* * This applet displays a summary of the Web site requirement scores * collected by applet Assessor.class. It does this by referencing * the data, scoreTable and lookUp arrays of the Assessor applet. The * privata data members are accessed via the Assessor class public "get" * methods. These applets must be stored in the same directory on the * server for them to function properly. * * Recommended dimensions for the applet: WIDTH = 750, HEIGHT = 800 * It may be necessary to increase the HEIGHT if more categories or * requirements are added to the text file used by the Assessor applet. */ public class Results extends Applet{ /** various Fonts used */ private Font font12, font14, font16, font18; public void init() { setBackground( Color.white ); /** create Fonts with specified font, style and size */ font12 = new Font( "Serif", Font.BOLD, 12 ); font14 = new Font( "Serif", Font.BOLD, 14 ); font16 = new Font( "Serif", Font.BOLD, 16 ); font18 = new Font( "Serif", Font.BOLD, 18 ); } public void paint( Graphics g ) { int vspace = 30; // vertical space between lines int leftMargin = 30; // x coordinate for left margin int indent = 45; // x coordinate for indentation int column = 300; // x coordinate for score column g.setFont( font18 ); g.drawString( "Web site Quality Assessor Results Summary", leftMargin, vspace+=20 ); vspace+= 20; g.setFont( font14 ); g.drawString( "Total score: " + Assessor.getTotalScore() + " out of " + Assessor.getOutOfPoints() + " (5 points possible per applicable requirement)", leftMargin, vspace+=20 ); g.setFont( font12 ); /* Print categories, requirements and score using the Assessor class "get" methods to access the static private data members numCategories: The number of quality categories data: Array storing the category and requirement names as Strings lookUp: Array storing the number of requirements per category scoreTable: Array storing the score for each requirement */ for( int i = 0; i < Assessor.getNumCategories(); i++ ) { g.drawString( Assessor.getDataString(i,0,0), leftMargin, vspace+=25 ); for( int j = 1; j <= Assessor.getLookUp(i,0); j++ ) { g.drawString( Assessor.getDataString(i,j,0), indent, vspace+=20 ); if( Assessor.getReqScore(i,j) == 0 ) g.drawString( "NA", column, vspace ); else g.drawString( "" + Assessor.getReqScore(i,j), column+10, vspace ); } } } }