Wason Task

It is easy to use the Card object to construct an applet for the Wason task. The following code constructs a Wason applet by creating four different Card objects. import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Wason extends Applet { public void init() { setLayout(new GridLayout(1,4,20,0)); add(new Card("E",Color.white,"E",Color.yellow,24)); add(new Card("K",Color.white,"K",Color.yellow,24)); add(new Card("4",Color.white,"4",Color.yellow,24)); add(new Card("5",Color.white,"5",Color.yellow,24)); repaint(); } }

Click on the two cards you would want to turn over to check the veracity of the statement that "All cards with vowels on one side, have even numbers on the other side."

Or by constructing slightly different Cards, we could give users feedback on their choices in this task, with Green indicating correct and Red indicating incorrect. The code would be identical to that above except the Card construction would be replaced by:

add(new Card("E",Color.white,"E",Color.green,24)); add(new Card("K",Color.white,"K",Color.red,24)); add(new Card("4",Color.white,"4",Color.red,24)); add(new Card("5",Color.white,"5",Color.green,24));

Try clicking the Cards below to observe the feedback provided.

Next Card example