Fall 2011

Lab02
Questions and Answers

Due: Thursday September 23, 2010 11:59 PM

Lab02 - Questions and Answers

Requirements

Comments placed in the source code file5 pts
Application placed in an executable JAR file5 pts
Questions can be viewed, edited, added, and deleted through a JTable20 pts
Answers can be viewed, edited, added, and deleted through a JTable20 pts
Questions and Answers are loaded from Data files and can be saved back to those files after changes are made30 pts
The relative popularity of Questions and Answers can be changed in a meaningful way20 pts
Total100 pts

Resources

Objective

To practice using JTables

Instructions

For this lab you will need to create a Java Application that allows a user to manage questions and answers. The application should make use of at least two JTables, one for displaying a list of questions which are stored in a questions data file, and another for showing answers which are stored in an answers data file (sample files available below).

The fields stored about a question are:

  • The Question's ID number
  • The Question's text (the question itself)
  • The Question's Asker (the person who asked the question, basically their name)
  • The Number of Times the Question has been viewed

The application should allow the user to view, edit, add, and remove questions from the file as well as providing some way to keep track of the number of times the question has been viewed indicating the questions popularity.

The application should also make the answers to each question available to the user in some way that makes it clear to the user which answers belong to which questions.

The fields stored about an answer are:

  • The Answer's ID
  • The Answer's Question ID (the ID number of the question this answer belongs to)
  • The Answer's text (the answer itself)
  • The person who answered the question (who this answer was provided by)
  • The Answer's popularity

The application should allow the user to view the answers for a specific question and should allow the user to add new answers, remove answers, edit answers, and indicate the popularity of an answer.