A Java Applet was created for use in the CIS-3330 Computer Organization course that I teach. Many students have problems with number conversions and terminology. This program quizzes students with problems that are randomly generated. The program is easily upgraded to other question types and topics by relying on an abstract Problem class and the use of polymorphism.
The program can be launched in a new window by visiting the web page located at http://www.programbetter.com/ts8802/project.html. The project page for this program is located at http://www.programbetter.com/ts8802/index.html.
I teach an online computer organization course each fall semester. Many of the students seem to struggle with number conversion problems such as converting a binary number into a decimal number. In addition, the students could benefit by taking practice quizzes over terminology and other course topics.
The solution to this problem was to create an online program that would generate random numeric practice problems as well as allow for terminology review and other multiple choice and fill-in-the-blank type questions. The program was coded as a Java Applet allowing easy access over the Internet by the students. Another advantage of using an Applet is that updates can be made to the program and the question set such that the students will always be using the latest version.
I wanted to keep the user interface as simple as possible. A drop down selection box is provided to allow the students to choose the type of problem they want to practice. Clicking the 'New Problem' button displays a new question in the question area on the screen. The student then types in an answer in the answer text box and clicks the 'Check It' button. The program indicates whether the students answer was correct. If not correct, the student can try to answer it again as many times as is necessary. In addition, the student can click on the 'Show Hint' button for a hint on how to solve this type of problem. If the student still cannot get it then they can click the 'Show Answer' button to see the correct answer. Clicking the 'New Problem' button will then generate the next problem for the student to solve. Below is a screen shot of the student's view of the applet.
Two UML documents were generated. The first is the overall class diagram. The class diagram shows all of the classes used by the applet. In addition, it show the relationships between the classes as well as the attributes and behaviors that each class has. The second is a general activity diagram. It shows a high-level view of the steps that occur as the applet runs and as the user interacts with the applet.
As mentioned, the applet was coded using the Java programming language. The focus of this project was to experiment with the latter ideas covered in the CIS3306 course. The main program contains the GUI code and extends Java's JApplet class. This program displays all of the buttons and text on the screen and handles the events triggered when the buttons are clicked. When the 'New Problem' button is clicked, the applet checks to see what type of problem is currently selected in the problem type drop down box. It then creates a new myProb object of that type and displays the question on the screen. The student can type in their solution and click the 'Check It' button to have the solution checked for correctness.
The interesting thing is that myProb is declared to be an object of the Problem class yet it is instantiated as an object of the BinToDec class (or whatever the selected problem type is). Throughout the rest of the applet the myProb object is referred to as a Problem object and yet gets treated as a BinToDec object. This polymorphism greatly simplifies adding new types of problems to the applet as very few changes need to be made to the applet. In addition, through inheritance, only a couple of methods need to be added to any new type of problem class. Most of the methods that are needed are inherited from the abstract Problem class.
The code is organized as follows:
project.html - code for the web page that launches the applet
Project.java - code for the Applet and GUI
Problem.java - code for the abstract Problem class
The following are the polymorphic classes that inherit from Problem.java:
BinToDec.java - code for binary to decimal conversions
DecToBin.java - code for decimal to binary conversions
BinToOct.java - code for binary to octal conversions
OctToBin.java - code for octal to binary conversions
BinToHex.java - code for binary to hexadecimal conversions
HexToBin.java - code for hexadecimal to binary conversions
Terms.java - code for random terminology questions
The program has only been tested on my home computer system running Windows XP and using Internet Explorer 6. It seems to work quite well on this system. However, this is the same operating system and browser my school is using so I do not expect any major compatibility problems.
I would like to extend the program a bit more by redoing the Terms class. I would like for it to retrieve problems either from a file or a database located on the web server. Then adding new multiple choice questions about terminology will be as simple as updating a text file with new questions and answers. In addition, I would like to create at least two other problem types, one for logical operators and one for 2's complement number conversions. I would like each of these classes to generate random problems as well.
Deitel & Deitel (2003). Java How To Program, 5th ed. Prentice Hall, NJ
Phillips, John (2003). Mansfield University CIS3306 project. http://www.programbetter.com/ts8802/. June 26, 2003.
Schmuller, Joseph (1999). Sams Teach Yourself UML in 24 Hours. Sams, IN
Sun Corporation (2003). Java 2 Platform Standard Edition v1.4.1 API. Sun Corporation. http://java.sun.com/j2se/1.4.1/docs/api/. June 26, 2003.