ukacgla_TruthTable
Class Ex01_Checker

java.lang.Object
  |
  +--ukacgla_ATT.Checker
        |
        +--ukacgla_TruthTable.Ex01_Checker

public class Ex01_Checker
extends Checker

Class contains methods to calculate the correct answer, to compare the student answer to the correct answer and to display the correct answer for a singl line.


Fields inherited from class ukacgla_ATT.Checker
correct, random, table, wrongLines
 
Constructor Summary
Ex01_Checker(TableUI t, TTRandom r)
           
 
Method Summary
protected  void calcAnswer(int row)
          calcAnswer() calculates the correct answer for a single row Each random.getRandomN() gets the type of gate at Gates 1, 2 and 3.
protected  void checkAnswer(int row)
          checkAnswer() will mark the answer being input for a single line.
protected  void revealAnswer(int row)
          revealAnswer will display the correct answer for a single row, after calcAnswer has calculated the correct answer for the row..
 
Methods inherited from class ukacgla_ATT.Checker
allCorrect, clearVector, wrongLines
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ex01_Checker

public Ex01_Checker(TableUI t,
                    TTRandom r)
Method Detail

calcAnswer

protected void calcAnswer(int row)
calcAnswer() calculates the correct answer for a single row Each random.getRandomN() gets the type of gate at Gates 1, 2 and 3. Each gate uses a switch to determine the type of gate, gets the relevent inputs to each gate as a string, concatenates the two input string and uses the concatenated string as an input argument to the correct truth table for each gate. The result is stored as an int in the ans1,2,3 variables for later comparison.
Overrides:
calcAnswer in class Checker

checkAnswer

protected void checkAnswer(int row)
checkAnswer() will mark the answer being input for a single line. calcAnswer() calculates the correct answer for the line, and stores the result in the ans1, ans2 and ans3 variables The student answers are read from the table and stored in ansM,ansN,ansO variables. The results for the line are displayed. The numbers of the lines containing errors are converted to string and added to the wrongLines vector.
Overrides:
checkAnswer in class Checker

revealAnswer

protected void revealAnswer(int row)
revealAnswer will display the correct answer for a single row, after calcAnswer has calculated the correct answer for the row..
Overrides:
revealAnswer in class Checker