001 /* PAVLOV -- Multiple Choice Study System 002 * Copyright (C) 2000 - 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 */ 019 package net.sourceforge.pavlov.pluglets.feedback.random; 020 021 /** 022 * A feedback mode that rewards the user for giving a quiz the 023 * old college try. Small penalty for incorrect answers, small 024 * reward for correct answers, reward for answering many questions. 025 * 026 * @version $Revision: 1.3 $ 027 */ 028 public final class BeginnerFeedbackMode 029 extends DefaultVisualFeedbackMode 030 { 031 private int nanswered; 032 private boolean right; 033 034 /** 035 * Creates a new <code>BeginnerFeedbackMode</code> instance. 036 * 037 */ 038 public BeginnerFeedbackMode() { 039 super(175, 0, 0, 175); 040 nanswered = 0; 041 size = 175; 042 } 043 044 /** 045 * Increments the size, gives bonuses every 5/25 questions. 046 * 047 */ 048 public void rightEvent() { 049 nanswered++; 050 size += 5; 051 if ((nanswered % 5) == 0) size = size + 15; 052 if ((nanswered % 25) == 0) size = size + 50; 053 right = true; 054 // setMessage(); 055 } 056 057 /** 058 * Gives an encouraging message. 059 * 060 * @return a <code>String</code> value 061 */ 062 public String getMessage() { 063 if (nanswered != 0) { 064 if (right) { 065 message = "Good Job!<BR>"; 066 } else { 067 message = "Keep pluggin'!!<BR>"; 068 } 069 if ((nanswered % 5) == 0) 070 message += "<B>Bonus awarded +20</B><BR>"; 071 if ((nanswered % 25) == 0) 072 message += "<B>Special Bonus awarded +50</B><BR>"; 073 } 074 return message; 075 } 076 077 /** 078 * Increments image size less than a rightEvent does, gives bonuses every 5/25 questions. 079 * 080 */ 081 public void wrongEvent() { 082 size -= 5; 083 if ((nanswered % 5) == 0) size = size + 15; 084 if ((nanswered % 25) == 0) size = size + 50; 085 if (size < minimumSize) size = minimumSize; 086 right = false; 087 } 088 089 /** 090 * Gets a menu-friendly name for this mode. 091 * 092 * @return a <code>String</code> value 093 */ 094 public String getShortName() { 095 return "Beginner"; 096 } 097 098 /** 099 * Gets a descriptive name for this mode. 100 * 101 * @return a <code>String</code> value 102 */ 103 public String toString() { 104 return "Beginner Feedback Mode"; 105 } 106 } 107