// Johann Shudlick // April 29, 1999 // Final Project // Create an appicaiton for tutoring and testing elemtentary school kids import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class resultsFrame extends Frame { private int correct, incorrect, percent; private GeoWhiz gw; private Image pig, flag; private int Xcoor = 25; private testFrame w; resultsFrame( int c, int i, GeoWhiz t) { super( "See How You Did!!!" ); setSize( 400, 300 ); setVisible( true ); w = new testFrame( t ); correct = c; incorrect = i; gw = t; percent = (int)( correct / 34 * 100 ); addWindowListener( new WindowHide(this) ); pig = gw.getImage( gw.getDocumentBase(), "flypigWHT.gif" ); flag = gw.getImage( gw.getDocumentBase(), "a-flag.gif" ); } public void paint( Graphics g ) { if( percent == 100 ) { g.drawImage( flag, 125, 250, this ); g.drawString( "A true patriot!!! Congratulations!!!", 50, 375 ); } if( percent < 70 ) { g.drawImage( pig, 125, 100, this ); g.drawString( "You think you'd pass geography? Yeah. Right. When pigs fly...", 10, 225 ); } g.drawString( "You answered " + correct + " questions correctly. Congratualtions!!!", 10, 50 ); g.drawString( "This gives you an overall score of " + percent + "%.", 10, 70 ); // g.drawString( "The city you listed for the Capital was incorrect for the following numbers:", 10, 100 ); // for( int i = 1; i < 18; i++ ) // { // if( w.cap[ i ] ) // { // g.drawString( " " + i, Xcoor, 120); // Xcoor = Xcoor + 14; // } // } // g.drawString( "The state name you provided was incorrect for the following numbers: ", 10, 160 ); // // Xcoor = 25; // for( int i = 1; i < 18; i++ ) // { // if( w.sta[ i ] ) // { // g.drawString( "" + i, Xcoor, 180); // Xcoor = Xcoor + 14; // } // } // } }