This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes New Quiz Card Builder/Player for Exam Study Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "New Quiz Card Builder/Player for Exam Study" Watch "New Quiz Card Builder/Player for Exam Study" New topic
Author

New Quiz Card Builder/Player for Exam Study

Ross Goldberg
Ranch Hand

Joined: Jul 09, 2003
Posts: 63
This probably is the wrong place to post this w/r to it being a program, but its purpose is to create and play back flashcards for the exam.
The original version was a learning tool in K & B's Head First Java. I have enhanced it as follows:
1. Give an area to type in the answer and display the answer (afterward) as well, so you can see the question and answer together with what you thought the answer should be (note that the type-in is optional).
2. Changed the card list from an ArrayList implementation to a HashSet implementation. I suppose in hindsight, I could have left it as an ArrayList, but felt a HashSet was better since we wanted to randomize the card order. It would also give us the potential to enforce the "no duplicates" provided we override equals and hashcode, but I haven't done so.
Basically, it pops up two screens...one for building cardsets and one for loading cardsets. These are not very robust (especially the building)...for example, there is currently no way to delete a created card. I just threw this enhancement together quickly to give me a better way to do flashcards for the two-minute drill synopses.
For the builder, type in a question and its answer. Keep building cards until you are ready to save a logical unit. At that point, use the File -> Save menu option to create the filename for the serialized cards.
For the player, choose File -> Load and select the filename of the cardset.
The player will then randomly pull cards and delete them once you go to select the next card. I convert the HashSet into an ArrayList and randomize on the # of cards in the HashSet to choose an extent in the ArrayList for display.
There are 3 modules and they need not be in a package---just in the same directory. After compiling them, run QuizCard. Closing either window ends the program.
With this version, you will iterate through the cardset randomly. You also have an area where you can type your answer in and display the real answer along-side it afterward.
Give it a try and I hope you find it useful for the test. Feel free to enhance it!! The two biggest missing features for me that I haven't put in are (1) the ability to remove a built card for a cardset that has not yet been saved, and (2) I would prefer tab to take you from the questionbuilder to the answerbuilder or from the answerbuilder to the makecard button.
Ross
Three files follow...just copy and paste each one into the appropriately named file:
Code for QuizCard.java:

Code for QuizCardBuilder.java:

Code for QuizCardReader.java:

[ August 02, 2003: Message edited by: Ross Goldberg ]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Ross - I didn't play with it -- but it looks like an excellent program. Thanks for supplying the source code! I'm sure it will help a bunch of people prepare for the exam. Thanks for sharing!


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Ross Goldberg
Ranch Hand

Joined: Jul 09, 2003
Posts: 63
You're welcome...I'll also e-mail Kathy Sierra offline to see what she thinks about using it as a baseline (since it is Bert's and Kathy's code that has been modified by me) for programming assignments....there are many things that could be done to make it far more robust and far more capable, such that in time we could make this a full-fledged flashcard and quiz program. Sure, there are probably a billion out there, but as you know, it's much more fun when it is partly your code!
Ross
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New Quiz Card Builder/Player for Exam Study
 
Similar Threads
QuizCard class not found. (Head First Java 2nd Ed)
Head First Java QuizCardBuilder not saving files correctly
Runtime Error in Program for Unknown Reasons
HeadFirst >>Chapter14:ArrayList Error
Problem reading JTextArea