Results 1 to 3 of 3
Thread: How do I manage this data?
- 12-29-2012, 05:10 AM #1
Member
- Join Date
- Nov 2010
- Posts
- 37
- Rep Power
- 0
How do I manage this data?
I'm creating a quiz where I am presented with a random question then when I press something the answer appears.
So I want to read in a file full of questions and answers.
questions start with q: and answers start with a:.
now I could quite easily create two arrays and the element indexes would line up appropriately... then I can use that data in my quiz.
but what if I don't have a one-to-one relationship?
what if my file is like this
Q: questionOne
A: answer1/1
Q: questionTwo
A1: answer1/3
A2: answer2/3
A3: answer3/3
if more than one answer can be associated with a question then my arrays obviously wont work... how do I read in a file like this and keep the information for each question?
thanks
- 12-29-2012, 06:05 AM #2
Member
- Join Date
- Dec 2012
- Posts
- 11
- Rep Power
- 0
Re: How do I manage this data?
One solution could be a two-dimensional array, so:
Java Code:String[][] answers = new String[2][5];
Last edited by Nouish; 12-29-2012 at 06:07 AM.
- 12-29-2012, 06:23 AM #3
Similar Threads
-
how can i manage working day hours
By davidmuleiro in forum New To JavaReplies: 1Last Post: 08-14-2012, 07:40 AM -
How to Manage different JPanel in an application
By jfabian in forum New To JavaReplies: 2Last Post: 07-30-2012, 04:20 AM -
Best way to manage images?
By sgthale in forum New To JavaReplies: 3Last Post: 09-30-2011, 02:11 AM -
Program to manage books
By datreta in forum New To JavaReplies: 6Last Post: 12-16-2010, 09:30 AM -
can't manage to get this
By mollentze in forum New To JavaReplies: 3Last Post: 01-11-2008, 11:03 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks